From 863cafed26d40b7dc655990da1f6a234b16375b0 Mon Sep 17 00:00:00 2001 From: lechuck <l3chuck@autistici.org> Date: Sat, 3 May 2014 15:47:37 +0000 Subject: [PATCH] Upgrade buddypress to 2.0.1 --- .../buddypress/bp-blogs/bp-blogs-activity.php | 65 ++++++++++ .../bp-blogs/bp-blogs-functions.php | 5 + .../bp-core/admin/bp-core-functions.php | 35 ------ .../bp-core/admin/bp-core-schema.php | 50 ++++++-- .../buddypress/bp-core/bp-core-admin.php | 1 + .../buddypress/bp-core/bp-core-classes.php | 2 +- .../buddypress/bp-core/bp-core-filters.php | 12 +- .../buddypress/bp-core/bp-core-update.php | 115 ++++++++++++------ .../bp-groups/bp-groups-functions.php | 1 + .../bp-groups/bp-groups-template.php | 39 ++++-- .../buddypress/bp-languages/buddypress.pot | 74 ++++++----- wp-content/plugins/buddypress/bp-loader.php | 6 +- .../bp-members/bp-members-admin.php | 4 + .../bp-members/bp-members-classes.php | 8 +- .../bp-members/bp-members-functions.php | 85 ++++++++++++- .../bp-settings/bp-settings-actions.php | 5 + .../bp-legacy/buddypress-functions.php | 2 +- .../bp-xprofile/bp-xprofile-activity.php | 4 + .../bp-xprofile/bp-xprofile-classes.php | 54 ++++++++ .../bp-xprofile/bp-xprofile-functions.php | 5 +- .../bp-xprofile/bp-xprofile-screens.php | 2 +- wp-content/plugins/buddypress/readme.txt | 11 +- 22 files changed, 432 insertions(+), 153 deletions(-) diff --git a/wp-content/plugins/buddypress/bp-blogs/bp-blogs-activity.php b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-activity.php index 7a867fb1b..70ea20a19 100644 --- a/wp-content/plugins/buddypress/bp-blogs/bp-blogs-activity.php +++ b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-activity.php @@ -852,3 +852,68 @@ function bp_blogs_activity_comment_permalink( $retval ) { return $retval; } add_filter( 'bp_get_activity_comment_permalink', 'bp_blogs_activity_comment_permalink' ); + +/** + * Changes single activity comment entries to use the blog comment permalink. + * + * This is only done if the activity comment is associated with a blog comment. + * + * @since BuddyPress (2.0.1) + * + * @param string $retval The activity permalink + * @param BP_Activity_Activity $activity + * @return string + */ +function bp_blogs_activity_comment_single_permalink( $retval, $activity ) { + if ( 'activity_comment' !== $activity->type ) { + return $retval; + } + + $blog_comment_id = bp_activity_get_meta( $activity->id, 'bp_blogs_post_comment_id' ); + + if ( ! empty( $blog_comment_id ) ) { + $retval = $activity->primary_link; + } + + return $retval; +} +add_filter( 'bp_activity_get_permalink', 'bp_blogs_activity_comment_single_permalink', 10, 2 ); + +/** + * Formats single activity comment entries to use the blog comment action. + * + * This is only done if the activity comment is associated with a blog comment. + * + * @since BuddyPress (2.0.1) + * + * @param string $retval The activity action + * @param BP_Activity_Activity $activity + * @return string + */ +function bp_blogs_activity_comment_single_action( $retval, $activity ) { + if ( 'activity_comment' !== $activity->type ) { + return $retval; + } + + $blog_comment_id = bp_activity_get_meta( $activity->id, 'bp_blogs_post_comment_id' ); + + if ( ! empty( $blog_comment_id ) ) { + // fetch the parent blog post activity item + $parent_blog_post_activity = new BP_Activity_Activity( $activity->item_id ); + + // fake a 'new_blog_comment' activity object + $object = $activity; + + // override 'item_id' to use blog ID + $object->item_id = $parent_blog_post_activity->item_id; + + // override 'secondary_item_id' to use comment ID + $object->secondary_item_id = $blog_comment_id; + + // now format the activity action using the 'new_blog_comment' action callback + $retval = bp_blogs_format_activity_action_new_blog_comment( '', $object ); + } + + return $retval; +} +add_filter( 'bp_get_activity_action_pre_meta', 'bp_blogs_activity_comment_single_action', 10, 2 ); diff --git a/wp-content/plugins/buddypress/bp-blogs/bp-blogs-functions.php b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-functions.php index 499e2e78e..384693ab4 100644 --- a/wp-content/plugins/buddypress/bp-blogs/bp-blogs-functions.php +++ b/wp-content/plugins/buddypress/bp-blogs/bp-blogs-functions.php @@ -540,6 +540,11 @@ function bp_blogs_update_post( $post ) { * @return bool|object Returns false on failure, the comment object on success. */ function bp_blogs_record_comment( $comment_id, $is_approved = true ) { + // bail if activity component is not active + if ( ! bp_is_active( 'activity' ) ) { + return; + } + // Get the users comment $recorded_comment = get_comment( $comment_id ); diff --git a/wp-content/plugins/buddypress/bp-core/admin/bp-core-functions.php b/wp-content/plugins/buddypress/bp-core/admin/bp-core-functions.php index 4daa6ae88..ae902773d 100644 --- a/wp-content/plugins/buddypress/bp-core/admin/bp-core-functions.php +++ b/wp-content/plugins/buddypress/bp-core/admin/bp-core-functions.php @@ -276,8 +276,6 @@ function bp_core_activation_notice() { 'id' => 'register', 'name' => __( 'Register', 'buddypress' ) ); - - bp_core_maybe_install_signups(); } // On the first admin screen after a new installation, this isn't set, so grab it to supress a misleading error message. @@ -793,39 +791,6 @@ function bp_admin_wp_nav_menu_restrict_items() { <?php } -/** - * Check if the signups table needs to be created. - * - * @since BuddyPress (2.0.0) - * - * @global $wpdb - */ -function bp_core_maybe_install_signups() { - global $wpdb; - - // Multisite installations already have the signups table. - if ( ! empty( $wpdb->signups ) ) { - return; - } - - $bp_signups = bp_core_get_table_prefix() . 'signups'; - - // Check for the table - $suppress = $wpdb->suppress_errors(); - $table_exists = $wpdb->get_results( "DESCRIBE {$bp_signups};" ); - $wpdb->suppress_errors( $suppress ); - - // Bail if the table exists - if ( ! empty( $table_exists ) ) { - return; - } - - // Signups is not there and we need it so let's create it - require_once( buddypress()->plugin_dir . '/bp-core/admin/bp-core-schema.php' ); - - bp_core_install_signups(); -} - /** * Add "Mark as Spam/Ham" button to user row actions. * diff --git a/wp-content/plugins/buddypress/bp-core/admin/bp-core-schema.php b/wp-content/plugins/buddypress/bp-core/admin/bp-core-schema.php index 3db4c1c5b..36edb0a05 100644 --- a/wp-content/plugins/buddypress/bp-core/admin/bp-core-schema.php +++ b/wp-content/plugins/buddypress/bp-core/admin/bp-core-schema.php @@ -51,9 +51,8 @@ function bp_core_install( $active_components = false ) { if ( !empty( $active_components['blogs'] ) ) bp_core_install_blog_tracking(); - // Install the signups table - bp_core_install_signups(); - + // Maybe install (or upgrade) the signups table + bp_core_maybe_install_signups(); } function bp_core_install_notifications() { @@ -348,6 +347,8 @@ function bp_core_install_blog_tracking() { dbDelta( $sql ); } +/** Signups *******************************************************************/ + /** * Install the signups table. * @@ -359,19 +360,15 @@ function bp_core_install_blog_tracking() { function bp_core_install_signups() { global $wpdb; - // Multisite installations already have the signups table - if ( ! empty( $wpdb->signups ) ) { - return; - } + // Signups is not there and we need it so let's create it + require_once( buddypress()->plugin_dir . '/bp-core/admin/bp-core-schema.php' ); + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); - $wpdb->signups = bp_core_get_table_prefix() . 'signups'; - - // Setting the charset to be sure WordPress upgrade.php is loaded - $charset_collate = bp_core_set_charset(); + // Never use bp_core_get_table_prefix() for any global users tables + $wpdb->signups = $wpdb->base_prefix . 'signups'; // Use WP's core CREATE TABLE query $create_queries = wp_get_db_schema( 'ms_global' ); - if ( ! is_array( $create_queries ) ) { $create_queries = explode( ';', $create_queries ); $create_queries = array_filter( $create_queries ); @@ -380,13 +377,40 @@ function bp_core_install_signups() { // Filter out all the queries except wp_signups foreach ( $create_queries as $key => $query ) { if ( preg_match( "|CREATE TABLE ([^ ]*)|", $query, $matches ) ) { - if ( $wpdb->signups != trim( $matches[1], '`' ) ) { + if ( trim( $matches[1], '`' ) !== $wpdb->signups ) { unset( $create_queries[ $key ] ); } } } + // Run WordPress's database upgrader if ( ! empty( $create_queries ) ) { dbDelta( $create_queries ); } } + +/** + * Update the signups table, adding `signup_id` column and drop `domain` index. + * + * This is necessary because WordPress's `pre_schema_upgrade()` function wraps + * table ALTER's in multisite checks, and other plugins may have installed their + * own sign-ups table; Eg: Gravity Forms User Registration Add On + * + * @since BuddyPress (2.0.1) + * + * @see pre_schema_upgrade() + * @link https://core.trac.wordpress.org/ticket/27855 WordPress Trac Ticket + * @link https://buddypress.trac.wordpress.org/ticket/5563 BuddyPress Trac Ticket + * + * @global WPDB $wpdb + */ +function bp_core_upgrade_signups() { + global $wpdb; + + // Never use bp_core_get_table_prefix() for any global users tables + $wpdb->signups = $wpdb->base_prefix . 'signups'; + + // Attempt to alter the signups table + $wpdb->query( "ALTER TABLE {$wpdb->signups} ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" ); + $wpdb->query( "ALTER TABLE {$wpdb->signups} DROP INDEX domain" ); +} diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-admin.php b/wp-content/plugins/buddypress/bp-core/bp-core-admin.php index 8c36a66fc..fdae95429 100644 --- a/wp-content/plugins/buddypress/bp-core/bp-core-admin.php +++ b/wp-content/plugins/buddypress/bp-core/bp-core-admin.php @@ -652,6 +652,7 @@ class BP_Admin { <?php printf( __( 'Thanks for updating! With a focus on speed, admin tools, and developer enhancements, BuddyPress %s is our leanest and most powerful version yet.', 'buddypress' ), $display_version ); ?> <?php endif; ?> </div> + <div class="bp-badge"></div> <h2 class="nav-tab-wrapper"> diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-classes.php b/wp-content/plugins/buddypress/bp-core/bp-core-classes.php index d1f2a23a3..16b99b06e 100644 --- a/wp-content/plugins/buddypress/bp-core/bp-core-classes.php +++ b/wp-content/plugins/buddypress/bp-core/bp-core-classes.php @@ -883,7 +883,7 @@ class BP_Core_User { $sql = array(); - $sql['select_main'] = "SELECT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.display_name, u.user_email"; + $sql['select_main'] = "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.display_name, u.user_email"; if ( 'active' == $type || 'online' == $type || 'newest' == $type ) { $sql['select_active'] = ", um.meta_value as last_activity"; diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-filters.php b/wp-content/plugins/buddypress/bp-core/bp-core-filters.php index 910e5a2f9..d5633dcea 100644 --- a/wp-content/plugins/buddypress/bp-core/bp-core-filters.php +++ b/wp-content/plugins/buddypress/bp-core/bp-core-filters.php @@ -537,10 +537,16 @@ function bp_setup_nav_menu_item( $menu_item ) { break; } + // If component is deactivated, make sure menu item doesn't render + if ( empty( $menu_item->url ) ) { + $menu_item->_invalid = true; + // Highlight the current page - $current = bp_get_requested_url(); - if ( strpos( $current, $menu_item->url ) !== false ) { - $menu_item->classes[] = 'current_page_item'; + } else { + $current = bp_get_requested_url(); + if ( strpos( $current, $menu_item->url ) !== false ) { + $menu_item->classes[] = 'current_page_item'; + } } return $menu_item; diff --git a/wp-content/plugins/buddypress/bp-core/bp-core-update.php b/wp-content/plugins/buddypress/bp-core/bp-core-update.php index 8b1f30e10..69fd07d1b 100644 --- a/wp-content/plugins/buddypress/bp-core/bp-core-update.php +++ b/wp-content/plugins/buddypress/bp-core/bp-core-update.php @@ -235,6 +235,11 @@ function bp_version_updater() { if ( $raw_db_version < 7892 ) { bp_update_to_2_0(); } + + // 2.0.1 + if ( $raw_db_version < 8311 ) { + bp_update_to_2_0_1(); + } } /** All done! *************************************************************/ @@ -243,6 +248,8 @@ function bp_version_updater() { bp_version_bump(); } +/** Upgrade Routines **********************************************************/ + /** * Remove unused metadata from database when upgrading from < 1.5. * @@ -338,9 +345,10 @@ function bp_update_to_1_9_2() { * - Ensure that the activity tables are installed, for last_activity storage. * - Migrate last_activity data from usermeta to activity table * - Add values for all BuddyPress options to the options table + * + * @since BuddyPress (2.0.0) */ function bp_update_to_2_0() { - global $wpdb; /** Install activity tables for 'last_activity' ***************************/ @@ -354,44 +362,11 @@ function bp_update_to_2_0() { if ( ! is_multisite() ) { - if ( empty( $wpdb->signups ) ) { - bp_core_install_signups(); - } - - $signups = get_users( array( - 'fields' => 'all_with_meta', - 'meta_key' => 'activation_key', - 'meta_compare' => 'EXISTS', - ) ); - - if ( empty( $signups ) ) { - return; - } - - foreach ( $signups as $signup ) { - $meta = array(); - - if ( bp_is_active( 'xprofile' ) ) { - $meta['field_1'] = $signup->display_name; - } - - $meta['password'] = $signup->user_pass; + // Maybe install the signups table + bp_core_maybe_install_signups(); - $user_login = preg_replace( '/\s+/', '', sanitize_user( $signup->user_login, true ) ); - $user_email = sanitize_email( $signup->user_email ); - - BP_Signup::add( array( - 'user_login' => $user_login, - 'user_email' => $user_email, - 'registered' => $signup->user_registered, - 'activation_key' => $signup->activation_key, - 'meta' => $meta - ) ); - - // Deleting these options will remove signups from users count - delete_user_option( $signup->ID, 'capabilities' ); - delete_user_option( $signup->ID, 'user_level' ); - } + // Run the migration script + bp_members_migrate_signups(); } /** Add BP options to the options table ***********************************/ @@ -399,6 +374,20 @@ function bp_update_to_2_0() { bp_add_options(); } +/** + * 2.0.1 database upgrade routine + * + * @since BuddyPress (2.0.1) + * + * @return void + */ +function bp_update_to_2_0_1() { + + // We purposely call this during both the 2.0 upgrade and the 2.0.1 upgrade. + // Don't worry; it won't break anything, and safely handles all cases. + bp_core_maybe_install_signups(); +} + /** * Redirect user to BP's What's New page on first page load after activation. * @@ -424,6 +413,56 @@ function bp_add_activation_redirect() { set_transient( '_bp_activation_redirect', true, 30 ); } +/** Signups *******************************************************************/ + +/** + * Check if the signups table needs to be created. + * + * @since BuddyPress (2.0.0) + * + * @global WPDB $wpdb + * + * @return bool If signups table exists + */ +function bp_core_maybe_install_signups() { + + // Bail if we are explicitly not upgrading global tables + if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { + return false; + } + + global $wpdb; + + // The table to run queries against + $signups_table = $wpdb->base_prefix . 'signups'; + + // Suppress errors because users shouldn't see what happens next + $old_suppress = $wpdb->suppress_errors(); + + // Never use bp_core_get_table_prefix() for any global users tables + $table_exists = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" ); + + // Table already exists, so maybe upgrade instead? + if ( true === $table_exists ) { + + // Look for the 'signup_id' column + $column_exists = $wpdb->query( "SHOW COLUMNS FROM {$signups_table} LIKE 'signup_id'" ); + + // 'signup_id' column doesn't exist, so run the upgrade + if ( empty( $column_exists ) ) { + bp_core_upgrade_signups(); + } + + // Table does not exist, and we are a single site, so install the multisite + // signups table using WordPress core's database schema. + } elseif ( ! is_multisite() ) { + bp_core_install_signups(); + } + + // Restore previous error suppression setting + $wpdb->suppress_errors( $old_suppress ); +} + /** Activation Actions ********************************************************/ /** diff --git a/wp-content/plugins/buddypress/bp-groups/bp-groups-functions.php b/wp-content/plugins/buddypress/bp-groups/bp-groups-functions.php index cfa573257..971f8b1bb 100644 --- a/wp-content/plugins/buddypress/bp-groups/bp-groups-functions.php +++ b/wp-content/plugins/buddypress/bp-groups/bp-groups-functions.php @@ -101,6 +101,7 @@ function groups_create_group( $args = '' ) { $group = groups_get_group( array( 'group_id' => (int) $group_id ) ); $name = ! empty( $name ) ? $name : $group->name; $slug = ! empty( $slug ) ? $slug : $group->slug; + $description = ! empty( $description ) ? $description : $group->description; // Groups need at least a name if ( empty( $name ) ) { diff --git a/wp-content/plugins/buddypress/bp-groups/bp-groups-template.php b/wp-content/plugins/buddypress/bp-groups/bp-groups-template.php index a59e61075..bca272a19 100644 --- a/wp-content/plugins/buddypress/bp-groups/bp-groups-template.php +++ b/wp-content/plugins/buddypress/bp-groups/bp-groups-template.php @@ -159,9 +159,29 @@ class BP_Groups_Template { if ( 'invites' == $type ) { $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page, $exclude ); } else if ( 'single-group' == $type ) { - $group = new stdClass; - $group->group_id = bp_get_current_group_id(); - $this->groups = array( $group ); + $this->single_group = true; + + if ( groups_get_current_group() ) { + $group = groups_get_current_group(); + + } else { + $group = groups_get_group( array( + 'group_id' => BP_Groups_Group::get_id_from_slug( $r['slug'] ), + 'populate_extras' => $r['populate_extras'], + ) ); + } + + // backwards compatibility - the 'group_id' variable is not part of the + // BP_Groups_Group object, but we add it here for devs doing checks against it + // + // @see https://buddypress.trac.wordpress.org/changeset/3540 + // + // this is subject to removal in a future release; devs should check against + // $group->id instead + $group->group_id = $group->id; + + $this->groups = array( $group ); + } else { $this->groups = groups_get_groups( array( 'type' => $type, @@ -185,9 +205,13 @@ class BP_Groups_Template { $this->group_count = (int) $this->groups['total']; $this->groups = $this->groups['groups']; } else if ( 'single-group' == $type ) { - $this->single_group = true; - $this->total_group_count = 1; - $this->group_count = 1; + if ( empty( $group->id ) ) { + $this->total_group_count = 0; + $this->group_count = 0; + } else { + $this->total_group_count = 1; + $this->group_count = 1; + } } else { if ( empty( $max ) || $max >= (int) $this->groups['total'] ) { $this->total_group_count = (int) $this->groups['total']; @@ -260,9 +284,6 @@ class BP_Groups_Template { $this->in_the_loop = true; $this->group = $this->next_group(); - if ( $this->single_group ) - $this->group = groups_get_current_group(); - if ( 0 == $this->current_group ) // loop has just started do_action('group_loop_start'); } diff --git a/wp-content/plugins/buddypress/bp-languages/buddypress.pot b/wp-content/plugins/buddypress/bp-languages/buddypress.pot index 6acd1c5c6..4d6b46dbb 100644 --- a/wp-content/plugins/buddypress/bp-languages/buddypress.pot +++ b/wp-content/plugins/buddypress/bp-languages/buddypress.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: BuddyPress \n" "Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n" -"POT-Creation-Date: 2014-04-15 14:30:37+00:00\n" +"POT-Creation-Date: 2014-04-18 17:30:35+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -316,8 +316,8 @@ msgstr "" #: bp-activity/bp-activity-admin.php:672 bp-activity/bp-activity-admin.php:1391 #: bp-forums/bp-forums-template.php:2112 bp-groups/bp-groups-admin.php:1396 #: bp-themes/bp-default/functions.php:509 bp-xprofile/bp-xprofile-admin.php:402 -#: bp-xprofile/bp-xprofile-loader.php:193 -#: bp-xprofile/bp-xprofile-loader.php:271 +#: bp-xprofile/bp-xprofile-loader.php:195 +#: bp-xprofile/bp-xprofile-loader.php:273 msgid "Edit" msgstr "" @@ -618,7 +618,7 @@ msgid "Search Activity..." msgstr "" #: bp-activity/bp-activity-loader.php:165 -#: bp-activity/bp-activity-loader.php:286 +#: bp-activity/bp-activity-loader.php:276 msgid "Personal" msgstr "" @@ -684,7 +684,7 @@ msgstr "" #: bp-templates/bp-legacy/buddypress/groups/single/admin.php:212 #: bp-themes/bp-default/groups/single/admin.php:185 #: bp-themes/bp-default/groups/single/admin.php:212 -#: bp-xprofile/bp-xprofile-loader.php:317 +#: bp-xprofile/bp-xprofile-loader.php:314 msgid "Profile picture of %s" msgstr "" @@ -860,8 +860,8 @@ msgstr "" #: bp-templates/bp-legacy/buddypress-functions.php:248 #: bp-themes/bp-default/activity/entry.php:37 #: bp-themes/bp-default/functions.php:166 -#: bp-xprofile/bp-xprofile-loader.php:183 -#: bp-xprofile/bp-xprofile-loader.php:263 +#: bp-xprofile/bp-xprofile-loader.php:185 +#: bp-xprofile/bp-xprofile-loader.php:265 msgid "View" msgstr "" @@ -1692,23 +1692,23 @@ msgstr "" msgid "About" msgstr "" -#: bp-core/bp-core-admin.php:496 bp-core/bp-core-admin.php:645 +#: bp-core/bp-core-admin.php:496 bp-core/bp-core-admin.php:647 msgid "Welcome to BuddyPress %s" msgstr "" -#: bp-core/bp-core-admin.php:499 +#: bp-core/bp-core-admin.php:499 bp-core/bp-core-admin.php:650 msgid "It’s a great time to use BuddyPress! With a focus on speed, admin tools, and developer enhancements, %s is our leanest and most powerful version yet." msgstr "" -#: bp-core/bp-core-admin.php:501 +#: bp-core/bp-core-admin.php:501 bp-core/bp-core-admin.php:652 msgid "Thanks for updating! With a focus on speed, admin tools, and developer enhancements, BuddyPress %s is our leanest and most powerful version yet." msgstr "" -#: bp-core/bp-core-admin.php:509 bp-core/bp-core-admin.php:651 +#: bp-core/bp-core-admin.php:509 bp-core/bp-core-admin.php:660 msgid "What’s New" msgstr "" -#: bp-core/bp-core-admin.php:511 bp-core/bp-core-admin.php:653 +#: bp-core/bp-core-admin.php:511 bp-core/bp-core-admin.php:662 msgid "Credits" msgstr "" @@ -1828,47 +1828,43 @@ msgstr "" msgid "<a href=\"%s\">…and lots more!</a>" msgstr "" -#: bp-core/bp-core-admin.php:623 bp-core/bp-core-admin.php:757 +#: bp-core/bp-core-admin.php:623 bp-core/bp-core-admin.php:766 msgid "Go to the BuddyPress Settings page" msgstr "" -#: bp-core/bp-core-admin.php:646 -msgid "BuddyPress %s is our first version with a new component in over two years. Not only that, there are plenty of new features, enhancements, and bug fixes." -msgstr "" - -#: bp-core/bp-core-admin.php:657 +#: bp-core/bp-core-admin.php:666 msgid "BuddyPress is created by a worldwide network of friendly folks." msgstr "" -#: bp-core/bp-core-admin.php:659 +#: bp-core/bp-core-admin.php:668 msgid "Project Leaders" msgstr "" -#: bp-core/bp-core-admin.php:664 +#: bp-core/bp-core-admin.php:673 msgid "Project Lead" msgstr "" -#: bp-core/bp-core-admin.php:669 bp-core/bp-core-admin.php:674 +#: bp-core/bp-core-admin.php:678 bp-core/bp-core-admin.php:683 msgid "Lead Developer" msgstr "" -#: bp-core/bp-core-admin.php:678 +#: bp-core/bp-core-admin.php:687 msgid "Core Team" msgstr "" -#: bp-core/bp-core-admin.php:683 bp-core/bp-core-admin.php:688 +#: bp-core/bp-core-admin.php:692 bp-core/bp-core-admin.php:697 msgid "Core Developer" msgstr "" -#: bp-core/bp-core-admin.php:693 +#: bp-core/bp-core-admin.php:702 msgid "Navigator" msgstr "" -#: bp-core/bp-core-admin.php:697 +#: bp-core/bp-core-admin.php:706 msgid "Recent Rockstars" msgstr "" -#: bp-core/bp-core-admin.php:709 +#: bp-core/bp-core-admin.php:718 msgid "Contributors to BuddyPress 2.0" msgstr "" @@ -2153,10 +2149,10 @@ msgid "Not recently active" msgstr "" #: bp-core/bp-core-loader.php:233 bp-members/bp-members-admin.php:329 -#: bp-members/bp-members-loader.php:184 bp-xprofile/bp-xprofile-loader.php:162 -#: bp-xprofile/bp-xprofile-loader.php:223 -#: bp-xprofile/bp-xprofile-loader.php:255 -#: bp-xprofile/bp-xprofile-loader.php:295 +#: bp-members/bp-members-loader.php:184 bp-xprofile/bp-xprofile-loader.php:164 +#: bp-xprofile/bp-xprofile-loader.php:225 +#: bp-xprofile/bp-xprofile-loader.php:257 +#: bp-xprofile/bp-xprofile-loader.php:339 msgid "Profile" msgstr "" @@ -2340,7 +2336,7 @@ msgstr "" #: bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php:8 #: bp-themes/bp-default/activity/post-form.php:45 #: bp-themes/bp-default/members/single/profile/profile-wp.php:8 -#: bp-xprofile/bp-xprofile-loader.php:312 +#: bp-xprofile/bp-xprofile-loader.php:309 msgid "My Profile" msgstr "" @@ -2842,7 +2838,7 @@ msgstr "" msgid "A member accepts your friendship request" msgstr "" -#: bp-friends/bp-friends-template.php:66 bp-xprofile/bp-xprofile-loader.php:122 +#: bp-friends/bp-friends-template.php:66 bp-xprofile/bp-xprofile-loader.php:124 msgid "My Friends" msgstr "" @@ -4566,8 +4562,8 @@ msgstr "" msgid "<strong>ERROR</strong>: Couldn’t register you. Please contact the <a href=\"mailto:%s\">webmaster</a>." msgstr "" -#: bp-members/bp-members-classes.php:512 bp-members/bp-members-classes.php:573 -#: bp-members/bp-members-classes.php:628 +#: bp-members/bp-members-classes.php:512 bp-members/bp-members-classes.php:577 +#: bp-members/bp-members-classes.php:632 msgid "the sign-up has already been activated." msgstr "" @@ -6264,8 +6260,8 @@ msgstr "" #: bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php:1 #: bp-themes/bp-default/members/single/profile/change-avatar.php:1 -#: bp-xprofile/bp-xprofile-loader.php:205 -#: bp-xprofile/bp-xprofile-loader.php:280 +#: bp-xprofile/bp-xprofile-loader.php:207 +#: bp-xprofile/bp-xprofile-loader.php:282 msgid "Change Avatar" msgstr "" @@ -7159,15 +7155,15 @@ msgstr "" msgid "Add Another Option" msgstr "" -#: bp-xprofile/bp-xprofile-loader.php:107 +#: bp-xprofile/bp-xprofile-loader.php:109 msgid "Everyone" msgstr "" -#: bp-xprofile/bp-xprofile-loader.php:111 +#: bp-xprofile/bp-xprofile-loader.php:113 msgid "Only Me" msgstr "" -#: bp-xprofile/bp-xprofile-loader.php:115 +#: bp-xprofile/bp-xprofile-loader.php:117 msgid "All Members" msgstr "" diff --git a/wp-content/plugins/buddypress/bp-loader.php b/wp-content/plugins/buddypress/bp-loader.php index 2a3dbdcaa..ecca3d5a2 100644 --- a/wp-content/plugins/buddypress/bp-loader.php +++ b/wp-content/plugins/buddypress/bp-loader.php @@ -16,7 +16,7 @@ * Description: Social networking in a box. Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress. * Author: The BuddyPress Community * Author URI: http://buddypress.org/community/members/ - * Version: 2.0 + * Version: 2.0.1 * Text Domain: buddypress * Domain Path: /bp-languages/ * License: GPLv2 or later (license.txt) @@ -303,8 +303,8 @@ class BuddyPress { /** Versions **************************************************/ - $this->version = '2.0'; - $this->db_version = 7892; + $this->version = '2.0.1'; + $this->db_version = 8311; /** Loading ***************************************************/ diff --git a/wp-content/plugins/buddypress/bp-members/bp-members-admin.php b/wp-content/plugins/buddypress/bp-members/bp-members-admin.php index e03c1a1d4..c1626bb37 100644 --- a/wp-content/plugins/buddypress/bp-members/bp-members-admin.php +++ b/wp-content/plugins/buddypress/bp-members/bp-members-admin.php @@ -822,6 +822,10 @@ class BP_Members_Admin { return; } + if ( ! function_exists( 'get_current_screen' ) ) { + return; + } + if ( $this->users_page != get_current_screen()->id ) { return; } diff --git a/wp-content/plugins/buddypress/bp-members/bp-members-classes.php b/wp-content/plugins/buddypress/bp-members/bp-members-classes.php index d2570d5a2..b986211b4 100644 --- a/wp-content/plugins/buddypress/bp-members/bp-members-classes.php +++ b/wp-content/plugins/buddypress/bp-members/bp-members-classes.php @@ -565,9 +565,13 @@ class BP_Signup { if ( ! empty( $user->errors ) ) { - $user_id = username_exists( $signup->user_login ) && 2 != self::check_user_status( $user_id ); + $user_id = username_exists( $signup->user_login ); - if ( !empty( $user_id ) ) { + if ( 2 !== self::check_user_status( $user_id ) ) { + $user_id = false; + } + + if ( empty( $user_id ) ) { // Status is not 2, so user's account has been activated $result['errors'][ $signup->signup_id ] = array( $signup->user_login, esc_html__( 'the sign-up has already been activated.', 'buddypress' ) ); diff --git a/wp-content/plugins/buddypress/bp-members/bp-members-functions.php b/wp-content/plugins/buddypress/bp-members/bp-members-functions.php index 6dbe40300..ad172a412 100644 --- a/wp-content/plugins/buddypress/bp-members/bp-members-functions.php +++ b/wp-content/plugins/buddypress/bp-members/bp-members-functions.php @@ -1054,10 +1054,6 @@ function bp_core_delete_account( $user_id = 0 ) { if ( empty( $user_id ) ) $user_id = bp_loggedin_user_id(); - // Bail if account deletion is disabled - if ( bp_disable_account_deletion() ) - return false; - // Site admins cannot be deleted if ( is_super_admin( $user_id ) ) return false; @@ -1637,6 +1633,87 @@ function bp_core_activate_signup( $key ) { return $user_id; } +/** + * Migrate signups from pre-2.0 configuration to wp_signups. + * + * @since BuddyPress (2.0.1) + */ +function bp_members_migrate_signups() { + global $wpdb; + + $status_2_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->users} WHERE user_status = '2'" ); + + if ( ! empty( $status_2_ids ) ) { + $signups = get_users( array( + 'fields' => array( + 'ID', + 'user_login', + 'user_pass', + 'user_registered', + 'user_email', + 'display_name', + ), + 'include' => $status_2_ids, + ) ); + + // Fetch activation keys separately, to avoid the all_with_meta + // overhead + $status_2_ids_sql = implode( ',', $status_2_ids ); + $ak_data = $wpdb->get_results( "SELECT user_id, meta_value FROM {$wpdb->usermeta} WHERE meta_key = 'activation_key' AND user_id IN ({$status_2_ids_sql})" ); + + // Rekey + $activation_keys = array(); + foreach ( $ak_data as $ak_datum ) { + $activation_keys[ intval( $ak_datum->user_id ) ] = $ak_datum->meta_value; + } + + unset( $status_2_ids_sql, $status_2_ids, $ak_data ); + + // Merge + foreach ( $signups as &$signup ) { + if ( isset( $activation_keys[ $signup->ID ] ) ) { + $signup->activation_key = $activation_keys[ $signup->ID ]; + } + } + + // Reset the signup var as we're using it to process the migration + unset( $signup ); + + } else { + return; + } + + foreach ( $signups as $signup ) { + $meta = array(); + + // Rebuild the activation key, if missing + if ( empty( $signup->activation_key ) ) { + $signup->activation_key = wp_hash( $signup->ID ); + } + + if ( bp_is_active( 'xprofile' ) ) { + $meta['field_1'] = $signup->display_name; + } + + $meta['password'] = $signup->user_pass; + + $user_login = preg_replace( '/\s+/', '', sanitize_user( $signup->user_login, true ) ); + $user_email = sanitize_email( $signup->user_email ); + + BP_Signup::add( array( + 'user_login' => $user_login, + 'user_email' => $user_email, + 'registered' => $signup->user_registered, + 'activation_key' => $signup->activation_key, + 'meta' => $meta + ) ); + + // Deleting these options will remove signups from users count + delete_user_option( $signup->ID, 'capabilities' ); + delete_user_option( $signup->ID, 'user_level' ); + } +} + function bp_core_new_user_activity( $user ) { if ( empty( $user ) || !bp_is_active( 'activity' ) ) return false; diff --git a/wp-content/plugins/buddypress/bp-settings/bp-settings-actions.php b/wp-content/plugins/buddypress/bp-settings/bp-settings-actions.php index d3e06f92b..db290e2c5 100644 --- a/wp-content/plugins/buddypress/bp-settings/bp-settings-actions.php +++ b/wp-content/plugins/buddypress/bp-settings/bp-settings-actions.php @@ -333,6 +333,11 @@ function bp_settings_action_delete_account() { return; } + // Bail if account deletion is disabled + if ( bp_disable_account_deletion() && ! bp_current_user_can( 'delete_users' ) ) { + return false; + } + // Nonce check check_admin_referer( 'delete-account' ); diff --git a/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress-functions.php b/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress-functions.php index bca42bba6..784b2dc21 100644 --- a/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress-functions.php +++ b/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress-functions.php @@ -706,7 +706,7 @@ function bp_legacy_theme_post_update() { if ( empty( $activity_id ) ) exit( '-1<div id="message" class="error"><p>' . __( 'There was a problem posting your update, please try again.', 'buddypress' ) . '</p></div>' ); - $last_recorded = isset( $_POST['since'] ) ? date( 'Y-m-d H:i:s', intval( $_POST['since'] ) ) : 0; + $last_recorded = ! empty( $_POST['since'] ) ? date( 'Y-m-d H:i:s', intval( $_POST['since'] ) ) : 0; if ( $last_recorded ) { $activity_args = array( 'since' => $last_recorded ); $bp->activity->last_recorded = $last_recorded; diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-activity.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-activity.php index 8f34b876e..23b9dc27c 100644 --- a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-activity.php +++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-activity.php @@ -235,6 +235,10 @@ function bp_xprofile_updated_profile_activity( $user_id, $field_ids, $errors, $o return false; } + if ( ! bp_is_active( 'activity' ) ) { + return false; + } + // Don't post if there have been no changes, or if the changes are // related solely to non-public fields $public_changes = false; diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php index 5351ca4e7..fe345c593 100644 --- a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php +++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-classes.php @@ -1514,6 +1514,7 @@ class BP_XProfile_Field_Type_Datebox extends BP_XProfile_Field_Type { <div class="datebox"> <label for="<?php bp_the_profile_field_input_name(); ?>_day"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php esc_html_e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <select <?php echo $day_html; ?>> <?php bp_the_profile_field_options( array( 'type' => 'day', 'user_id' => $user_id ) ); ?> @@ -1738,6 +1739,7 @@ class BP_XProfile_Field_Type_Checkbox extends BP_XProfile_Field_Type { <div class="checkbox"> <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php esc_html_e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <?php bp_the_profile_field_options( "user_id={$user_id}" ); ?> </div> @@ -1875,6 +1877,7 @@ class BP_XProfile_Field_Type_Radiobutton extends BP_XProfile_Field_Type { <div class="radio"> <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php esc_html_e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <?php bp_the_profile_field_options( "user_id={$user_id}" ); if ( ! bp_get_the_profile_field_is_required() ) : ?> @@ -2019,6 +2022,7 @@ class BP_XProfile_Field_Type_Multiselectbox extends BP_XProfile_Field_Type { ) ); ?> <label for="<?php bp_the_profile_field_input_name(); ?>[]"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <select <?php echo $html; ?>> <?php bp_the_profile_field_options( "user_id={$user_id}" ); ?> </select> @@ -2163,6 +2167,7 @@ class BP_XProfile_Field_Type_Selectbox extends BP_XProfile_Field_Type { $html = $this->get_edit_field_html_elements( $raw_properties ); ?> <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php esc_html_e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <select <?php echo $html; ?>> <?php bp_the_profile_field_options( "user_id={$user_id}" ); ?> </select> @@ -2302,6 +2307,7 @@ class BP_XProfile_Field_Type_Textarea extends BP_XProfile_Field_Type { ) ); ?> <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php esc_html_e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <textarea <?php echo $html; ?>><?php bp_the_profile_field_edit_value(); ?></textarea> <?php } @@ -2384,6 +2390,7 @@ class BP_XProfile_Field_Type_Textbox extends BP_XProfile_Field_Type { ) ); ?> <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php esc_html_e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <input <?php echo $html; ?>> <?php } @@ -2463,6 +2470,7 @@ class BP_XProfile_Field_Type_Number extends BP_XProfile_Field_Type { ) ); ?> <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php esc_html_e( '(required)', 'buddypress' ); ?><?php endif; ?></label> + <?php do_action( bp_get_the_profile_field_errors_action() ); ?> <input <?php echo $html; ?>> <?php } @@ -2496,6 +2504,52 @@ class BP_XProfile_Field_Type_Number extends BP_XProfile_Field_Type { public function admin_new_field_html( BP_XProfile_Field $current_field, $control_type = '' ) {} } +/** + * A placeholder xprofile field type. Doesn't do anything. + * + * Used if an existing field has an unknown type (e.g. one provided by a missing third-party plugin). + * + * @since BuddyPress (2.0.1) + */ +class BP_XProfile_Field_Type_Placeholder extends BP_XProfile_Field_Type { + + /** + * Constructor for the placeholder field type. + * + * @since BuddyPress (2.0.1) + */ + public function __construct() { + $this->set_format( '/.*/', 'replace' ); + } + + /** + * Prevent any HTML being output for this field type. + * + * @param array $raw_properties Optional key/value array of {@link http://dev.w3.org/html5/markup/input.text.html permitted attributes} that you want to add. + * @since BuddyPress (2.0.1) + */ + public function edit_field_html( array $raw_properties = array() ) { + } + + /** + * Prevent any HTML being output for this field type. + * + * @param array $raw_properties Optional key/value array of permitted attributes that you want to add. + * @since BuddyPress (2.0.1) + */ + public function admin_field_html( array $raw_properties = array() ) { + } + + /** + * Prevent any HTML being output for this field type. + * + * @param BP_XProfile_Field $current_field The current profile field on the add/edit screen. + * @param string $control_type Optional. HTML input type used to render the current field's child options. + * @since BuddyPress (2.0.1) + */ + public function admin_new_field_html( BP_XProfile_Field $current_field, $control_type = '' ) {} +} + /** * Represents a type of XProfile field and holds meta information about the type of value that it accepts. * diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-functions.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-functions.php index 31f890a93..a165405bc 100644 --- a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-functions.php +++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-functions.php @@ -95,13 +95,12 @@ function bp_xprofile_create_field_type( $type ) { $class = isset( $field[$type] ) ? $field[$type] : ''; /** - * For backpat and to handle (missing) field types introduced by other plugins, fallback to - * textbox if a type is unknown. Textbox validation and display is intentionally low key. + * To handle (missing) field types, fallback to a placeholder field object if a type is unknown. */ if ( $class && class_exists( $class ) ) { return new $class; } else { - return new BP_XProfile_Field_Type_Textbox; + return new BP_XProfile_Field_Type_Placeholder; } } diff --git a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-screens.php b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-screens.php index 4eea462a6..14172bff4 100644 --- a/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-screens.php +++ b/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-screens.php @@ -232,5 +232,5 @@ function bp_xprofile_screen_settings() { } // Load the template - bp_core_load_template( apply_filters( 'bp_settings_screen_xprofile', '/members/single/plugin' ) ); + bp_core_load_template( apply_filters( 'bp_settings_screen_xprofile', '/members/single/settings/profile' ) ); } diff --git a/wp-content/plugins/buddypress/readme.txt b/wp-content/plugins/buddypress/readme.txt index 517f740d4..097f277c5 100644 --- a/wp-content/plugins/buddypress/readme.txt +++ b/wp-content/plugins/buddypress/readme.txt @@ -3,7 +3,7 @@ Contributors: johnjamesjacoby, DJPaul, boonebgorges, r-a-y Tags: social networking, activity, profiles, messaging, friends, groups, forums, notifications, settings, twitter, facebook, social, community, networks, networking, cms Requires at least: 3.6 Tested up to: 3.9 -Stable tag: 2.0 +Stable tag: 2.0.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -77,6 +77,9 @@ BuddyPress is available in more than 20 languages. For more information, check o == Upgrade Notice == += 2.0.1 = +See: http://codex.buddypress.org/releases/version-2-0-1/ + = 2.0 = See: http://codex.buddypress.org/releases/version-2-0/ @@ -139,6 +142,12 @@ Fixes over 10 bugs. == Changelog == += 2.0.1 = +See: http://codex.buddypress.org/releases/version-2-0-1/ + += 2.0 = +See: http://codex.buddypress.org/releases/version-2-0/ + = 1.9 = See: http://codex.buddypress.org/releases/version-1-9/ -- GitLab