Skip to:
Content

BuddyPress.org

Ticket #5807: 5807.disable_new_member.patch

File 5807.disable_new_member.patch, 2.0 KB (added by imath, 7 years ago)
  • src/bp-activity/bp-activity-classes.php

    diff --git src/bp-activity/bp-activity-classes.php src/bp-activity/bp-activity-classes.php
    index a595611..1d91ded 100644
    class BP_Activity_Activity { 
    329329                // Where conditions
    330330                $where_conditions = array();
    331331
     332                // Excluded types
     333                $excluded_types = array();
     334
    332335                // Spam
    333336                if ( 'ham_only' == $spam )
    334337                        $where_conditions['spam_sql'] = 'a.is_spam = 0';
    class BP_Activity_Activity { 
    380383                // comments in the stream like normal comments or threaded below
    381384                // the activity.
    382385                if ( false === $display_comments || 'threaded' === $display_comments ) {
    383                         $where_conditions[] = "a.type != 'activity_comment'";
     386                        $excluded_types[] = 'activity_comment';
    384387                }
    385388
    386389                // Exclude 'last_activity' items unless the 'action' filter has
    387390                // been explicitly set
    388391                if ( empty( $filter['object'] ) ) {
    389                         $where_conditions[] = "a.type != 'last_activity'";
     392                        $excluded_types[] = 'last_activity';
     393                }
     394
     395                // Exclude 'new_member' items if xprofile component is not active
     396                if ( ! bp_is_active( 'xprofile' ) ) {
     397                        $excluded_types[] = 'new_member';
     398                }
     399
     400                // Build the excluded type sql part
     401                if ( ! empty( $excluded_types ) ) {
     402                        $not_in = "'" . implode( "', '", esc_sql( $excluded_types ) ) . "'";
     403                        $where_conditions['excluded_types'] = "a.type NOT IN ({$not_in})";
    390404                }
    391405
    392406                // Filter the where conditions
  • src/bp-members/bp-members-functions.php

    diff --git src/bp-members/bp-members-functions.php src/bp-members/bp-members-functions.php
    index 145b52d..6a6de27 100644
    function bp_members_migrate_signups() { 
    18501850 * @param array $user Array of userdata passed to bp_core_activated_user hook.
    18511851 */
    18521852function bp_core_new_user_activity( $user ) {
    1853         if ( empty( $user ) || ! bp_is_active( 'activity' ) ) {
     1853        if ( empty( $user ) || ! bp_is_active( 'activity' ) || ! bp_is_active( 'xprofile' ) ) {
    18541854                return false;
    18551855        }
    18561856