BuddyPress - Version 5.1.0

Version Description

See: https://codex.buddypress.org/releases/version-5-1-0/

Download this release

Release Info

Developer imath
Plugin Icon 128x128 BuddyPress
Version 5.1.0
Comparing to
See all releases

Code changes from version 5.1.0-beta1 to 5.1.0

bp-core/bp-core-filters.php CHANGED
@@ -477,7 +477,7 @@ function bp_core_activation_signup_blog_notification( $domain, $path, $title, $u
477
  );
478
 
479
  $salutation = $user;
480
- if ( $signups ) {
481
  $signup = $signups['signups'][0];
482
  if ( isset( $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
483
  $salutation = $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ];
@@ -539,7 +539,7 @@ function bp_core_activation_signup_user_notification( $user, $user_email, $key,
539
  }
540
 
541
  $salutation = $user;
542
- if ( isset( $meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
543
  $salutation = $meta[ 'field_' . bp_xprofile_fullname_field_id() ];
544
  } elseif ( $user_id ) {
545
  $salutation = bp_core_get_user_displayname( $user_id );
477
  );
478
 
479
  $salutation = $user;
480
+ if ( $signups && bp_is_active( 'xprofile' ) ) {
481
  $signup = $signups['signups'][0];
482
  if ( isset( $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
483
  $salutation = $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ];
539
  }
540
 
541
  $salutation = $user;
542
+ if ( bp_is_active( 'xprofile' ) && isset( $meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
543
  $salutation = $meta[ 'field_' . bp_xprofile_fullname_field_id() ];
544
  } elseif ( $user_id ) {
545
  $salutation = bp_core_get_user_displayname( $user_id );
bp-core/classes/class-bp-walker-nav-menu.php CHANGED
@@ -11,12 +11,12 @@
11
  defined( 'ABSPATH' ) || exit;
12
 
13
  /**
14
- * Create HTML list of BP nav items.
 
15
  *
16
- * @since 1.7.0
17
  */
18
- class BP_Walker_Nav_Menu extends Walker_Nav_Menu {
19
-
20
  /**
21
  * Description of fields indexes for building markup.
22
  *
@@ -47,15 +47,16 @@ class BP_Walker_Nav_Menu extends Walker_Nav_Menu {
47
  * those have ID/post_parent.
48
  *
49
  * @since 1.7.0
 
50
  *
51
  * @see Walker::walk()
52
  *
53
  * @param array $elements See {@link Walker::walk()}.
54
  * @param int $max_depth See {@link Walker::walk()}.
 
55
  * @return string See {@link Walker::walk()}.
56
  */
57
- public function walk( $elements, $max_depth ) {
58
- $args = array_slice( func_get_args(), 2 );
59
  $output = '';
60
 
61
  if ( $max_depth < -1 ) // Invalid parameter.
@@ -211,3 +212,9 @@ class BP_Walker_Nav_Menu extends Walker_Nav_Menu {
211
  $output .= apply_filters( 'bp_walker_nav_menu_start_el', $item_output, $item, $depth, $args );
212
  }
213
  }
 
 
 
 
 
 
11
  defined( 'ABSPATH' ) || exit;
12
 
13
  /**
14
+ * Compatibility Class to make BP_Walker_Nav_Menu::walk() compatible
15
+ * from PHP 5.3 to 5.6 and up.
16
  *
17
+ * @since 5.1.0
18
  */
19
+ class BP_Walker_Nav_Menu_Compat extends Walker_Nav_Menu {
 
20
  /**
21
  * Description of fields indexes for building markup.
22
  *
47
  * those have ID/post_parent.
48
  *
49
  * @since 1.7.0
50
+ * @since 5.1.0 Method was renamed from `walk` to `do_walk` to ensure PHP 5.3 compatibility
51
  *
52
  * @see Walker::walk()
53
  *
54
  * @param array $elements See {@link Walker::walk()}.
55
  * @param int $max_depth See {@link Walker::walk()}.
56
+ * @param array $args Optional additional arguments.
57
  * @return string See {@link Walker::walk()}.
58
  */
59
+ public function do_walk( $elements, $max_depth, $args = array() ) {
 
60
  $output = '';
61
 
62
  if ( $max_depth < -1 ) // Invalid parameter.
212
  $output .= apply_filters( 'bp_walker_nav_menu_start_el', $item_output, $item, $depth, $args );
213
  }
214
  }
215
+
216
+ if ( PHP_VERSION_ID >= 50600 ) {
217
+ require_once dirname( __DIR__ ) . '/compat/php56/class-bp-compat-walker-nav-menu.php';
218
+ } else {
219
+ require_once dirname( __DIR__ ) . '/compat/php53/class-bp-compat-walker-nav-menu.php';
220
+ }
bp-core/compat/php53/class-bp-compat-walker-nav-menu.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Walker_Nav_Menu Compat for PHP 5.3 and UP.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage Core
7
+ * @since 5.1.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ defined( 'ABSPATH' ) || exit;
12
+
13
+ /**
14
+ * Create HTML list of BP nav items.
15
+ *
16
+ * @since 1.7.0
17
+ */
18
+ class BP_Walker_Nav_Menu extends BP_Walker_Nav_Menu_Compat {
19
+ /**
20
+ * Compat method to extend Walker_Nav_Menu::walk() in PHP < 5.6.
21
+ *
22
+ * @since 5.1.0
23
+ *
24
+ * @param array $elements See {@link Walker::walk()}.
25
+ * @param int $max_depth See {@link Walker::walk()}.
26
+ */
27
+ public function walk( $elements, $max_depth ) {
28
+ $args = array_slice( func_get_args(), 2 );
29
+
30
+ return $this->do_walk( $elements, $max_depth, $args );
31
+ }
32
+ }
bp-core/compat/php56/class-bp-compat-walker-nav-menu.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Walker_Nav_Menu Compat for PHP 5.6 and UP.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage Core
7
+ * @since 5.1.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ defined( 'ABSPATH' ) || exit;
12
+
13
+ /**
14
+ * Create HTML list of BP nav items.
15
+ *
16
+ * @since 1.7.0
17
+ */
18
+ class BP_Walker_Nav_Menu extends BP_Walker_Nav_Menu_Compat {
19
+ /**
20
+ * Compat method to extend Walker_Nav_Menu::walk() in PHP > 5.6.
21
+ *
22
+ * @since 5.1.0
23
+ *
24
+ * @param array $elements See {@link Walker::walk()}.
25
+ * @param int $max_depth See {@link Walker::walk()}.
26
+ * @param mixed ...$args See {@link Walker::walk()}.
27
+ */
28
+ public function walk( $elements, $max_depth, ...$args ) { // phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ellipsisFound
29
+ return $this->do_walk( $elements, $max_depth, $args );
30
+ }
31
+ }
bp-loader.php CHANGED
@@ -15,7 +15,7 @@
15
  * Description: BuddyPress adds community features to WordPress. Member Profiles, Activity Streams, Direct Messaging, Notifications, and more!
16
  * Author: The BuddyPress Community
17
  * Author URI: https://buddypress.org/
18
- * Version: 5.1.0-beta1
19
  * Text Domain: buddypress
20
  * Domain Path: /bp-languages/
21
  * License: GPLv2 or later (license.txt)
15
  * Description: BuddyPress adds community features to WordPress. Member Profiles, Activity Streams, Direct Messaging, Notifications, and more!
16
  * Author: The BuddyPress Community
17
  * Author URI: https://buddypress.org/
18
+ * Version: 5.1.0
19
  * Text Domain: buddypress
20
  * Domain Path: /bp-languages/
21
  * License: GPLv2 or later (license.txt)
bp-members/bp-members-functions.php CHANGED
@@ -1776,7 +1776,7 @@ function bp_core_signup_user( $user_login, $user_password, $user_email, $usermet
1776
  */
1777
  if ( apply_filters( 'bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta ) ) {
1778
  $salutation = $user_login;
1779
- if ( isset( $usermeta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
1780
  $salutation = $usermeta[ 'field_' . bp_xprofile_fullname_field_id() ];
1781
  }
1782
 
1776
  */
1777
  if ( apply_filters( 'bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta ) ) {
1778
  $salutation = $user_login;
1779
+ if ( bp_is_active( 'xprofile' ) && isset( $usermeta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
1780
  $salutation = $usermeta[ 'field_' . bp_xprofile_fullname_field_id() ];
1781
  }
1782
 
bp-members/classes/class-bp-signup.php CHANGED
@@ -640,7 +640,7 @@ class BP_Signup {
640
  // Send the validation email.
641
  } else {
642
  $salutation = $signup->user_login;
643
- if ( isset( $meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
644
  $salutation = $meta[ 'field_' . bp_xprofile_fullname_field_id() ];
645
  }
646
 
640
  // Send the validation email.
641
  } else {
642
  $salutation = $signup->user_login;
643
+ if ( bp_is_active( 'xprofile' ) && isset( $meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
644
  $salutation = $meta[ 'field_' . bp_xprofile_fullname_field_id() ];
645
  }
646
 
bp-templates/bp-nouveau/includes/groups/ajax.php CHANGED
@@ -470,23 +470,27 @@ function bp_nouveau_ajax_remove_group_invite() {
470
  wp_send_json_error( $response );
471
  }
472
 
473
- // Verify pending invite.
474
- $invites_args = array(
475
- 'is_confirmed' => false,
476
- 'is_banned' => null,
477
- 'is_admin' => null,
478
- 'is_mod' => null,
479
- );
480
- $invites = bp_get_user_groups( $user_id, $invites_args );
481
- if ( empty( $invites ) ) {
482
  wp_send_json_error( $response );
483
  }
484
 
485
- if ( ! groups_is_user_admin( bp_loggedin_user_id(), $group_id ) ) {
 
 
 
 
486
  wp_send_json_error( $response );
487
  }
488
 
489
- if ( BP_Groups_Member::check_for_membership_request( $user_id, $group_id ) ) {
490
  wp_send_json_error(
491
  array(
492
  'feedback' => __( 'The member is already a member of the group.', 'buddypress' ),
@@ -496,8 +500,8 @@ function bp_nouveau_ajax_remove_group_invite() {
496
  );
497
  }
498
 
499
- // Remove the unsent invitation.
500
- if ( ! groups_uninvite_user( $user_id, $group_id ) ) {
501
  wp_send_json_error(
502
  array(
503
  'feedback' => __( 'Group invitation could not be removed.', 'buddypress' ),
470
  wp_send_json_error( $response );
471
  }
472
 
473
+ // Verify that a sent invite exists.
474
+ $inviter_ids = groups_get_invites( array(
475
+ 'user_id' => $user_id,
476
+ 'item_id' => $group_id,
477
+ 'invite_sent' => 'sent',
478
+ 'fields' => 'inviter_ids'
479
+ ) );
480
+
481
+ if ( empty( $inviter_ids ) ) {
482
  wp_send_json_error( $response );
483
  }
484
 
485
+ // Is the current user the inviter?
486
+ $inviter_id = in_array( bp_loggedin_user_id(), $inviter_ids, true ) ? bp_loggedin_user_id() : false;
487
+
488
+ // A site moderator, group admin or the inviting user should be able to remove an invitation.
489
+ if ( ! bp_is_item_admin() && ! $inviter_id ) {
490
  wp_send_json_error( $response );
491
  }
492
 
493
+ if ( groups_is_user_member( $user_id, $group_id ) ) {
494
  wp_send_json_error(
495
  array(
496
  'feedback' => __( 'The member is already a member of the group.', 'buddypress' ),
500
  );
501
  }
502
 
503
+ // Remove the invitation.
504
+ if ( ! groups_uninvite_user( $user_id, $group_id, $inviter_id ) ) {
505
  wp_send_json_error(
506
  array(
507
  'feedback' => __( 'Group invitation could not be removed.', 'buddypress' ),
buddypress.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPLv2 or later (license.txt).
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: BuddyPress 5.1.0-beta1\n"
6
  "Report-Msgid-Bugs-To: https://buddypress.trac.wordpress.org\n"
7
- "POT-Creation-Date: 2019-11-06 02:01:17+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -9974,15 +9974,15 @@ msgid "Invitations sent."
9974
  msgstr ""
9975
 
9976
  #: bp-templates/bp-nouveau/includes/groups/ajax.php:464
9977
- #: bp-templates/bp-nouveau/includes/groups/ajax.php:503
9978
  msgid "Group invitation could not be removed."
9979
  msgstr ""
9980
 
9981
- #: bp-templates/bp-nouveau/includes/groups/ajax.php:492
9982
  msgid "The member is already a member of the group."
9983
  msgstr ""
9984
 
9985
- #: bp-templates/bp-nouveau/includes/groups/ajax.php:512
9986
  msgid "There are no more pending invitations for the group."
9987
  msgstr ""
9988
 
2
  # This file is distributed under the GPLv2 or later (license.txt).
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: BuddyPress 5.1.0\n"
6
  "Report-Msgid-Bugs-To: https://buddypress.trac.wordpress.org\n"
7
+ "POT-Creation-Date: 2019-12-09 20:58:56+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
9974
  msgstr ""
9975
 
9976
  #: bp-templates/bp-nouveau/includes/groups/ajax.php:464
9977
+ #: bp-templates/bp-nouveau/includes/groups/ajax.php:507
9978
  msgid "Group invitation could not be removed."
9979
  msgstr ""
9980
 
9981
+ #: bp-templates/bp-nouveau/includes/groups/ajax.php:496
9982
  msgid "The member is already a member of the group."
9983
  msgstr ""
9984
 
9985
+ #: bp-templates/bp-nouveau/includes/groups/ajax.php:516
9986
  msgid "There are no more pending invitations for the group."
9987
  msgstr ""
9988
 
class-buddypress.php CHANGED
@@ -303,7 +303,7 @@ class BuddyPress {
303
 
304
  /** Versions **********************************************************/
305
 
306
- $this->version = '5.1.0-beta1';
307
  $this->db_version = 12385;
308
 
309
  /** Loading ***********************************************************/
303
 
304
  /** Versions **********************************************************/
305
 
306
+ $this->version = '5.1.0';
307
  $this->db_version = 12385;
308
 
309
  /** Loading ***********************************************************/
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: johnjamesjacoby, DJPaul, boonebgorges, r-a-y, imath, mercime, tw2113, dcavins, hnla, karmatosed, slaFFik, dimensionmedia, henrywright, netweb, offereins, espellcaste, modemlooper, danbp, Venutius, apeatling, shanebp
3
  Tags: user profiles, activity streams, messaging, friends, user groups, notifications, community, social networking, intranet
4
  Requires at least: 4.7
5
- Tested up to: 5.2
6
  Requires PHP: 5.3
7
- Stable tag: 5.0.0
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -125,6 +125,9 @@ Try <a href="https://wordpress.org/plugins/bbpress/">bbPress</a>. It integrates
125
 
126
  == Upgrade Notice ==
127
 
 
 
 
128
  = 5.0.0 =
129
  See: https://codex.buddypress.org/releases/version-5-0-0/
130
 
@@ -145,6 +148,9 @@ See: https://codex.buddypress.org/releases/version-4-0-0/
145
 
146
  == Changelog ==
147
 
 
 
 
148
  = 5.0.0 =
149
  See: https://codex.buddypress.org/releases/version-5-0-0/
150
 
2
  Contributors: johnjamesjacoby, DJPaul, boonebgorges, r-a-y, imath, mercime, tw2113, dcavins, hnla, karmatosed, slaFFik, dimensionmedia, henrywright, netweb, offereins, espellcaste, modemlooper, danbp, Venutius, apeatling, shanebp
3
  Tags: user profiles, activity streams, messaging, friends, user groups, notifications, community, social networking, intranet
4
  Requires at least: 4.7
5
+ Tested up to: 5.3
6
  Requires PHP: 5.3
7
+ Stable tag: 5.1.0
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
125
 
126
  == Upgrade Notice ==
127
 
128
+ = 5.1.0 =
129
+ See: https://codex.buddypress.org/releases/version-5-1-0/
130
+
131
  = 5.0.0 =
132
  See: https://codex.buddypress.org/releases/version-5-0-0/
133
 
148
 
149
  == Changelog ==
150
 
151
+ = 5.1.0 =
152
+ See: https://codex.buddypress.org/releases/version-5-1-0/
153
+
154
  = 5.0.0 =
155
  See: https://codex.buddypress.org/releases/version-5-0-0/
156