Skip to content

Instantly share code, notes, and snippets.

@gabrielmerovingi
Created August 14, 2017 09:09
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/83c2c9f6fb2bd71a3aa5a751a65d0c93 to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/83c2c9f6fb2bd71a3aa5a751a65d0c93 to your computer and use it in GitHub Desktop.
function mycred_pro_maybe_hide_message_charge( $content ) {
// Only applicable to texts starting with New Reply:
if ( substr( $content, 0, 10 ) == 'New Reply:' && function_exists( 'bp_loggedin_user_id' ) ) {
$user_id = bp_loggedin_user_id();
// If a user does not the bp_charges_pay capability
// hide the message
if ( ! user_can( 'bp_charges_pay', $user_id ) )
return '';
}
return $content;
}
add_filter( 'mycred_parse_tags_general', 'mycred_pro_maybe_hide_message_charge' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment