Skip to content

Instantly share code, notes, and snippets.

@gabrielmerovingi
Created August 2, 2017 12:08
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/b750b4f028efe65fd39a575480a215af to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/b750b4f028efe65fd39a575480a215af to your computer and use it in GitHub Desktop.
Exempt users with a specific capability from being charged for sending private messages in BP Charges.
/**
* Maybe Charge Message
* Exempt users with a specific capability from being
* charged for sending private messages in BP Charges.
* @version 1.0
*/
function mycred_pro_maybe_charge_new_message( $charge, $thread_id, $module ) {
$user_id = bp_loggedin_user_id();
// If user has a certain capability, exempt them from the charge
if ( user_can( $user_id, 'edit_users' ) )
return false;
return $charge;
}
add_filter( 'mycred_bp_charge_new_message', 'mycred_pro_maybe_charge_new_message', 10, 3 );
add_filter( 'mycred_bp_charge_new_reply', 'mycred_pro_maybe_charge_new_message', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment