From 1fe3a7dbfb2e768a1afbe320840ef69bfd6d2cb4 Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Thu, 16 May 2019 15:03:12 -0500 Subject: [PATCH 01/12] BUG FIX: Only getting members in directory if membership levels exist. --- includes/directory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/directory.php b/includes/directory.php index 45147b1..9f7b62e 100644 --- a/includes/directory.php +++ b/includes/directory.php @@ -62,6 +62,10 @@ function pmpro_bp_get_members_in_directory() { } $pmpro_levels = pmpro_getAllLevels(true, true); + + if ( empty( $pmpro_levels ) ) { + return array(); + } //see if we should include them in the member directory. $include_levels = array(); From d4ae9531354090c54a2ea19032125aca8f93993e Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Thu, 16 May 2019 15:03:55 -0500 Subject: [PATCH 02/12] changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 28451aa..d994fcf 100644 --- a/readme.txt +++ b/readme.txt @@ -100,6 +100,7 @@ This plugin also allows you to use the BuddyPress user registration process (in == Changelog == = 1.2.3 = +* BUG FIX: Only getting members in directory if membership levels exist. * BUG FIX: Now locking down all of BuddyPress when a level's settings are set to use non-member settings and BuddyPress is locked down for non-members. * BUG FIX: Fixed issue with admin menu link sometimes pointing to the wrong address. * BUG FIX: Hiding friend request and messaging buttons if user doesn't have access. From f473a77d094ad4e33b00374bde59485837d0edd8 Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Thu, 16 May 2019 15:04:27 -0500 Subject: [PATCH 03/12] tested up to 5.2 --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index d994fcf..276c5a3 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.1.1 +Tested up to: 5.2 Stable tag: 1.2.3 Manage access to your BuddyPress Community using Paid Memberships Pro From d6cc04486f3eeda0b3c10687b34375a5191a11e9 Mon Sep 17 00:00:00 2001 From: Jason Coleman Date: Sun, 19 May 2019 10:51:17 -0400 Subject: [PATCH 04/12] Also checking if non-member users are given all access --- includes/directory.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/directory.php b/includes/directory.php index 9f7b62e..3e932d5 100644 --- a/includes/directory.php +++ b/includes/directory.php @@ -89,7 +89,8 @@ function pmpro_bp_get_members_in_directory() { function pmpro_bp_is_member_directory_locked() { $non_user_options = pmpro_bp_get_level_options( 0 ); - if( !$non_user_options['pmpro_bp_member_directory'] ) { + if( $non_user_options['pmpro_bp_restrictions'] != PMPROBP_GIVE_ALL_ACCESS + && ! $non_user_options['pmpro_bp_member_directory'] ) { return true; } else { return false; From 08b8d428b263cee820a72e32dc3ce04675aeaa92 Mon Sep 17 00:00:00 2001 From: Jason Coleman Date: Sun, 19 May 2019 10:52:42 -0400 Subject: [PATCH 05/12] avoid a sql error if non levels are included in the directory --- includes/directory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/directory.php b/includes/directory.php index 3e932d5..3ca17f7 100644 --- a/includes/directory.php +++ b/includes/directory.php @@ -77,6 +77,10 @@ function pmpro_bp_get_members_in_directory() { $include_levels[] = $level->id; } } + + if ( empty( $include_levels ) ) { + return array(); + } $sql = "SELECT DISTINCT user_id FROM $wpdb->pmpro_memberships_users WHERE membership_id IN (" . implode(",", array_map("intval", $include_levels)) . ") AND status = 'active'"; From 827ac432fd8eec692ac096d040ad7e41069a56ef Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Thu, 23 May 2019 15:39:43 -0500 Subject: [PATCH 06/12] 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. --- includes/common.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/includes/common.php b/includes/common.php index 3c9fdc3..7108458 100644 --- a/includes/common.php +++ b/includes/common.php @@ -27,15 +27,8 @@ function pmpro_bp_get_level_options( $level_id ) { // defaults $options = $default_options; } elseif ( $level_id == 0 ) { - // non-member users $options = get_option( 'pmpro_bp_options_users', $default_options ); - - // Non-members might be locked down. - if ( PMPROBP_LOCK_ALL_ACCESS == $options['pmpro_bp_restrictions'] ) { - $options = $default_options; - } - } else { // level options $options = get_option( 'pmpro_bp_options_' . $level_id, $default_options ); @@ -43,6 +36,7 @@ function pmpro_bp_get_level_options( $level_id ) { // might be set to mirror non-member users if ( $options['pmpro_bp_restrictions'] == PMPROBP_USE_NON_MEMBER_SETTINGS ) { $non_member_user_options = pmpro_bp_get_level_options( 0 ); + $options['pmpro_bp_restrictions'] = $non_member_user_options['pmpro_bp_restrictions']; $options['pmpro_bp_group_creation'] = $non_member_user_options['pmpro_bp_group_creation']; $options['pmpro_bp_group_single_viewing'] = $non_member_user_options['pmpro_bp_group_single_viewing']; $options['pmpro_bp_groups_page_viewing'] = $non_member_user_options['pmpro_bp_groups_page_viewing']; From f222b50e173befca09aa300ecb95eec3ff74fbc3 Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Thu, 23 May 2019 15:41:42 -0500 Subject: [PATCH 07/12] changelog --- readme.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.txt b/readme.txt index 276c5a3..c98813c 100644 --- a/readme.txt +++ b/readme.txt @@ -99,6 +99,9 @@ This plugin also allows you to use the BuddyPress user registration process (in == Changelog == += 1.2.4 = +* 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 = * BUG FIX: Only getting members in directory if membership levels exist. * BUG FIX: Now locking down all of BuddyPress when a level's settings are set to use non-member settings and BuddyPress is locked down for non-members. From 34af3d82d749287776afb5a144c10003461327ca Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Thu, 23 May 2019 15:42:23 -0500 Subject: [PATCH 08/12] version --- pmpro-buddypress.php | 2 +- readme.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pmpro-buddypress.php b/pmpro-buddypress.php index 4c5deda..6bd1a1d 100755 --- a/pmpro-buddypress.php +++ b/pmpro-buddypress.php @@ -3,7 +3,7 @@ Plugin Name: Paid Memberships Pro - BuddyPress Add On Plugin URI: https://www.paidmembershipspro.com/add-ons/buddypress-integration Description: Manage access to your BuddyPress Community using Paid Memberships Pro. - Version: 1.2.3 + Version: 1.2.4 Author: Paid Memberships Pro Author URI: https://www.paidmembershipspro.com Text Domain: pmpro-buddypress diff --git a/readme.txt b/readme.txt index c98813c..59f353e 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: strangerstudios, great-h-master Tags: paid memberships pro, pmpro, buddypress Requires at least: 4 -Tested up to: 5.2 -Stable tag: 1.2.3 +Tested up to: 5.2.1 +Stable tag: 1.2.4 Manage access to your BuddyPress Community using Paid Memberships Pro From 2f0146a49f4c6976c47ced524f4e2a3a05547cb9 Mon Sep 17 00:00:00 2001 From: Jason Coleman Date: Mon, 3 Jun 2019 15:47:56 -0400 Subject: [PATCH 09/12] Catching cases where the pmpro levels page is not set (i.e. 0) --- includes/restrictions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/restrictions.php b/includes/restrictions.php index fd24472..5d1e1bb 100644 --- a/includes/restrictions.php +++ b/includes/restrictions.php @@ -195,7 +195,7 @@ function pmpro_bp_buddypress_or_pmpro_registration() { $pmpro_bp_register = get_option( 'pmpro_bp_registration_page' ); - if( !empty( $pmpro_bp_register ) && $pmpro_bp_register == 'buddypress' && ( $post->ID == $pmpro_pages['levels'] ) && !is_user_logged_in() ) { + if( !empty( $pmpro_bp_register ) && $pmpro_bp_register == 'buddypress' && $post->ID != 0 && $post->ID == $pmpro_pages['levels'] && !is_user_logged_in() ) { //Use BuddyPress Register page wp_redirect( get_permalink( $bp_pages['register'] ) ); exit; From 55986df7928e027dd51dd56153504180e75e74a6 Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Fri, 28 Jun 2019 19:01:22 -0500 Subject: [PATCH 10/12] BUG FIX: Fixed issue where the WP profile was still being restricted from users without access to BP. --- includes/profiles.php | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) 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' ); From e2d455029a13c87de2c9e435a293380626a4cc53 Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Fri, 28 Jun 2019 19:03:39 -0500 Subject: [PATCH 11/12] Updated 'tested up to' --- readme.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 59f353e..fb3a5a9 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 @@ -100,6 +100,7 @@ This plugin also allows you to use the BuddyPress user registration process (in == Changelog == = 1.2.4 = +* 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 = From 0a79b6dd7a49c87f18d59d4348a0fe77ee777f72 Mon Sep 17 00:00:00 2001 From: Jessica Oros Date: Fri, 28 Jun 2019 19:05:28 -0500 Subject: [PATCH 12/12] added release date to changelog --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index fb3a5a9..69db349 100644 --- a/readme.txt +++ b/readme.txt @@ -99,7 +99,7 @@ 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.