Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active October 4, 2023 08:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewlimaza/df8670f0e08b14ba963941b9e8dc034b to your computer and use it in GitHub Desktop.
Save andrewlimaza/df8670f0e08b14ba963941b9e8dc034b to your computer and use it in GitHub Desktop.
Remove 'Hide From Directory' in user profile Paid Memberships Pro
<?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