Created
August 2, 2017 12:08
-
-
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.
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
/** | |
* 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