Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save champsupertramp/e7ac5453c0a8e3c6549153a09f0dc281 to your computer and use it in GitHub Desktop.
Save champsupertramp/e7ac5453c0a8e3c6549153a09f0dc281 to your computer and use it in GitHub Desktop.
Ultimate Member - Private Messages - Hide Message button in current viewing profile for Specific User Role
/** More UM tutorial at www.champ.ninja **/
function um_private_message_button_visiblity(){
if ( class_exists( 'UM_Messaging_API' ) && ! um_is_myprofile() ) { // Apply this logic when not in his own profile
$user_id = get_current_user_id();
um_fetch_user( $user_id );
if( um_user("role") == "free-tier-member" ){ // Hide member buttons from Free Tier roles
remove_action( 'um_profile_navbar', array( UM()->Messaging_API()->profile(), 'add_profile_bar' ), 5 );
}
}
}
add_action("template_redirect","um_private_message_button_visiblity", 9999999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment