get_users function not working

  • Unknown's avatar

    Hello. I have this function I have run every single night and a couple weeks ago it randomly stopped working. I have been trying to get it fixed since, but cannot figure it out. It worked again a few days in a row last week and then stopped working again even though nothing on the site was update and the function was untouched. Can you help me figure out the problem please? It seems to stop running when it goes to retrieve the array of users each time. Below is the function.

    add_action( ‘expire_user_points_cron’, ‘mycred_expiration_event’ );
    function mycred_expiration_event() {
    wp_mail( ‘(email visible only to moderators and staff)’, ‘Expire Points’, ‘Started’);
    $args = array(
    ‘include’ => $user_ids
    );
    $users = get_users($args);
    wp_mail( ‘(email visible only to moderators and staff)’, ‘Expire Points’, ‘Grabbed Users’);
    foreach ($users as $user){
    $userid = $user->id;
    $balance = mycred_get_users_balance( $userid );
    $subtract = -1 * $balance;
    if ($balance > 0) {
    wp_mail( ‘(email visible only to moderators and staff)’, ‘Expire Points’, ‘Expired Points for a User’);
    mycred_add(
    ‘remove_points’,
    $userid,
    $subtract,
    ‘%plural% reset’
    );
    };
    }
    wp_mail( ‘(email visible only to moderators and staff)’, ‘Expire Points’, ‘DriveZone Points Removed’);

    }

  • Hi,

    Your site does not appear to be hosted on WordPress.com.

    There are two things commonly called “WordPress”.

    1. WordPress the free open-source site building software from WordPress.org (this is what you used to build your website).

    2. WordPress.com, a web host for sites using WordPress software.

    The two are related, but completely separate entities. Please read this page for more info on how they are related:

    WordPress.com vs. WordPress.org

    As a completely volunteer based organization offering a free product, WordPress (the open-source software) does not have a phone number, an office, or a support team. Questions are often answered in their forums by helpful community members.

    https://wordpress.org/support/forums/

    WordPress.com (which you have reached) is a business and does have a support team. But we can only assist with sites that are hosted on our servers. We cannot help with sites hosted elsewhere but built with the WordPress open-source software.

    Should your web host help you with this? That would depend entirely on what your hosting package offers for support. Some web hosts offer very high touch WordPress specific support (I would include WordPress.com here). Some only offer that kind of support in higher tier or WordPress-focused hosting packages. While others offer nothing aside from getting you set up with your server space and cpanel/FTP access. You’d have to ask your host what your specific plan offers. And if your current plan doesn’t offer what you need, if there is an option for more focused WordPress support on a higher tier plan.

    Let us know if anything is unclear or you have any further questions.

    Does that make sense? Let us know if not or if you have further questions.

  • The topic ‘get_users function not working’ is closed to new replies.