Skip to content

Instantly share code, notes, and snippets.

@gabrielmerovingi
Created November 26, 2014 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmerovingi/7b6b2d0b7bff0a6df9c1 to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/7b6b2d0b7bff0a6df9c1 to your computer and use it in GitHub Desktop.
Excludes any user that does not have the "edit_post" capability from using myCRED.
/**
* Exclude Subscribers
* Excludes any user that does not have the "edit_posts" capability.
* On a default WordPress installation this will exclude all users with the
* "Subscriber" role.
* For more information on roles and capabilities please consult the
* WordPress codex: http://codex.wordpress.org/Roles_and_Capabilities
* @version 1.0
*/
add_filter( 'mycred_exclude_user', 'exclude_subscriber_from_mycred', 10, 2 );
function exclude_subscriber_from_mycred( $reply, $user_id ) {
if ( ! user_can( $user_id, 'edit_posts' ) )
return true;
return $reply;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment