diff --git a/includes/profiles.php b/includes/profiles.php index 654f2f0..32c1af9 100644 --- a/includes/profiles.php +++ b/includes/profiles.php @@ -65,4 +65,40 @@ function pmpro_bp_xprofile_updated_profile( $user_id, $posted_field_ids, $errors } } } -add_action( 'xprofile_updated_profile', 'pmpro_bp_xprofile_updated_profile', 1, 5 ); \ No newline at end of file +add_action( 'xprofile_updated_profile', 'pmpro_bp_xprofile_updated_profile', 1, 5 ); + +/** + * Filter edit profile link based on user's BuddyPress access. + * + * @since 1.2.4 + */ +function pmpro_bp_init_edit_profile_url() { + + global $current_user; + + $user_options = pmpro_bp_get_user_options( $current_user->ID ); + + if ( PMPROBP_LOCK_ALL_ACCESS == $user_options['pmpro_bp_restrictions'] ) { + remove_filter( 'edit_profile_url', 'bp_members_edit_profile_url', 10, 3 ); + } +} +add_action( 'init', 'pmpro_bp_init_edit_profile_url' ); + +/** + * Remove "Extended Profile" tab based on user's BuddyPress access. + * + * @since 1.2.4 + */ +function pmpro_bp_profile_nav() { + + global $current_user, $bp; + + $user_options = pmpro_bp_get_user_options( $current_user->ID ); + + if ( PMPROBP_LOCK_ALL_ACCESS == $user_options['pmpro_bp_restrictions'] ) { + remove_action( 'edit_user_profile', array( $bp->members->admin, 'profile_nav' ), 99, 1 ); + remove_action( 'show_user_profile', array( $bp->members->admin, 'profile_nav' ), 99, 1 ); + } +} +add_action( 'edit_user_profile', 'pmpro_bp_profile_nav' ); +add_action( 'show_user_profile', 'pmpro_bp_profile_nav' ); diff --git a/readme.txt b/readme.txt index 59f353e..69db349 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: strangerstudios, great-h-master Tags: paid memberships pro, pmpro, buddypress Requires at least: 4 -Tested up to: 5.2.1 +Tested up to: 5.2.2 Stable tag: 1.2.4 Manage access to your BuddyPress Community using Paid Memberships Pro @@ -99,7 +99,8 @@ This plugin also allows you to use the BuddyPress user registration process (in == Changelog == -= 1.2.4 = += 1.2.4 - 2019-06-28 = +* BUG FIX: Fixed issue where the WP profile was still being restricted from users without access to BP. * BUG FIX: Fixed issue where the 'restrict all of BuddyPress' setting wasn't being applied correctly when levels were set to use non-member settings. = 1.2.3 =