restrict to custom role
-
Hi Michael,
I hope you’re well,
I’d need your help on this: I need to prevent a custom role on my website from earning badges but I also want those users to be able to visit the badges pages.I thought of using the filter user_has_access_to_achievement but I can’t get it to work… can you please help me on this?
Thank you so much in advance, here is the code I tried:
add_filter( 'user_has_access_to_achievement', 'restrict_role_from_achievements', 1, 1 ); function restrict_role_from_achievements() { // If role is subscriber_threshold - decline if ( current_user_can ('subscriber_threshold') return false; else return true; }
have a great day,
émilien
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘restrict to custom role’ is closed to new replies.