Skip to content

Instantly share code, notes, and snippets.

@gabrielmerovingi
Created October 19, 2016 10:51
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/7ca426c1288d2992637c89d0209a8f48 to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/7ca426c1288d2992637c89d0209a8f48 to your computer and use it in GitHub Desktop.
Exclude subscribers from a custom point type.
/**
* 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