Created
August 2, 2017 12:14
-
-
Save gabrielmerovingi/802c12072533af848ee700bea6ce9baa to your computer and use it in GitHub Desktop.
Pretend users that are exempt from being charged can afford to send new messages even if their balance is zero.
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
/** | |
* Pretend User Can Afford | |
* Pretend users that are exempt from being charged can afford to send | |
* new messages even if their balance is zero. | |
* @version 1.0 | |
*/ | |
function mycred_pro_pretend_user_can_afford( $can_afford ) { | |
$user_id = bp_loggedin_user_id(); | |
// If user has a certain capability, pretend they can afford things | |
if ( user_can( $user_id, 'edit_users' ) ) | |
return true; | |
return $can_afford; | |
} | |
add_filter( 'mycred_bp_charge_can_afford', 'mycred_pro_pretend_user_can_afford' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment