Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author myCred

    (@designbymerovingi)

    Hey.

    Do you mean “Daily Points” that you give out via the Banking add-on or are you referring to the “Points for daily visits” hook?

    Thread Starter iamonlythird

    (@iamonlythird)

    I mean the “Points for daily visits” hook.

    Plugin Author myCred

    (@designbymerovingi)

    In that case, assuming you are using the default Roles in WordPress, you can use the mycred_add filter to stop anyone who is just a “Subscriber” from gaining points for daily visits.

    Add the following code snippet to your theme’s functions.php file and you are set:

    add_filter( 'mycred_add', 'mycred_pro_limit_daily_visits', 15, 3 );
    function mycred_pro_limit_daily_visits( $reply, $request, $mycred ) {
    
    	if ( $request['ref'] == 'site_visit' && ! user_can( $request['user_id'], 'edit_posts' ) ) return false;
    	return $reply;
    
    }

    Thread Starter iamonlythird

    (@iamonlythird)

    I have put this code into test and it is not working. I tested it on fresh install of WP4 too.

    Subscribers are still awarded daily points. Maybe there is a bug in your code or do you have a different working approach to this?

    Thank you and hope you are having a good weekend!

    Plugin Author myCred

    (@designbymerovingi)

    Hi.

    Try changing:

    add_filter( 'mycred_add', 'mycred_pro_limit_daily_visits', 15, 3 );

    to:

    add_filter( 'mycred_add', 'mycred_pro_limit_daily_visits', 1, 3 );

    Thread Starter iamonlythird

    (@iamonlythird)

    Works great, thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disallow specific user role to receive daily points’ is closed to new replies.