Last active
October 4, 2023 08:20
-
-
Save andrewlimaza/df8670f0e08b14ba963941b9e8dc034b to your computer and use it in GitHub Desktop.
Remove 'Hide From Directory' in user profile Paid Memberships Pro
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
<?php | |
/** | |
* Remove the 'Hide From Directory' option in Paid Memberships Pro from user profiles. | |
* Add the following function to your PMPro Customizations plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_hide_pmpro_member_directory_options(){ | |
// Hide for non-admins | |
if ( ! current_user_can( 'manage_options' ) ) { | |
remove_action( 'show_user_profile', 'pmpromd_show_extra_profile_fields' ); | |
remove_action( 'edit_user_profile', 'pmpromd_show_extra_profile_fields' ); | |
remove_action( 'pmpro_show_user_profile', 'pmpromd_show_extra_profile_fields' ); | |
remove_action( 'personal_options_update', 'pmpromd_save_extra_profile_fields' ); | |
remove_action( 'edit_user_profile_update', 'pmpromd_save_extra_profile_fields' ); | |
remove_action( 'pmpro_personal_options_update', 'pmpromd_save_extra_profile_fields' ); | |
} | |
} | |
add_action( 'init', 'my_hide_pmpro_member_directory_options' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment