Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/12/2014 09:31:40 PM (7 years ago)
Author:
imath
Message:

Do not add "new_member" activities if xProfile component is disabled

In Members component, bp_core_new_user_activity() automatically creates an "xProfile" activity item ("new_member" type) as soon as a user account is activated. If this happens when the xProfile component is disabled, the proper activity action callback is not available, as a result an empty string is saved in the action field of the activity table. On front-end and back-end, these mini activities are displayed without any actions.

This is a temporary fix for 2.1, we will think about something more substantial for 2.2.

See #5807

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-classes.php

    r8787 r8818  
    334334        $where_conditions = array();
    335335
     336        // Excluded types
     337        $excluded_types = array();
     338
    336339        // Spam
    337340        if ( 'ham_only' == $spam )
     
    392395        // the activity.
    393396        if ( false === $display_comments || 'threaded' === $display_comments ) {
    394             $where_conditions[] = "a.type != 'activity_comment'";
     397            $excluded_types[] = 'activity_comment';
    395398        }
    396399
     
    398401        // been explicitly set
    399402        if ( empty( $filter['object'] ) ) {
    400             $where_conditions[] = "a.type != 'last_activity'";
     403            $excluded_types[] = 'last_activity';
     404        }
     405
     406        // Exclude 'new_member' items if xprofile component is not active
     407        if ( ! bp_is_active( 'xprofile' ) ) {
     408            $excluded_types[] = 'new_member';
     409        }
     410
     411        // Build the excluded type sql part
     412        if ( ! empty( $excluded_types ) ) {
     413            $not_in = "'" . implode( "', '", esc_sql( $excluded_types ) ) . "'";
     414            $where_conditions['excluded_types'] = "a.type NOT IN ({$not_in})";
    401415        }
    402416
Note: See TracChangeset for help on using the changeset viewer.