Created
October 19, 2016 10:51
-
-
Save gabrielmerovingi/7ca426c1288d2992637c89d0209a8f48 to your computer and use it in GitHub Desktop.
Exclude subscribers from a custom point type.
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 from Specific Type | |
* @mycred | |
* @version 1.0 | |
*/ | |
add_filter( 'mycred_exclude_user', 'mycredpro_exclude_wp_subscribers_from_points', 10, 3 ); | |
function mycredpro_exclude_wp_subscribers_from_points( $exclude, $user_id, $mycred ) { | |
// Only applicable for a specific point type | |
if ( $mycred->cred_id != 'mycustomtype' ) return $exclude; | |
// Exclude subscribers | |
if ( ! user_can( $user_id, 'edit_posts' ) ) return true; | |
return $exclude; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment