Created
November 26, 2014 15:40
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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