Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/25/2018 11:12:06 PM (7 years ago)
Author:
r-a-y
Message:

Groups: Wrap groups_record_activity() calls with bp_is_active( 'activity' )

In r11924, the bp-groups-activity.php file is loaded only if the Activity
component is enabled.

However, the groups_record_activity() function is located in this file.
Because this function now relies on the Activity component, if the Activity
component is disabled, a fatal error can occur during certain group
actions. This commit addresses the problem by checking for the Activity
component before calling on the function.

Anti-props r-a-y.

See #7870 (trunk).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r12124 r12126  
    586586
    587587    // Record this in activity streams.
    588     groups_record_activity( array(
    589         'type'    => 'joined_group',
    590         'item_id' => $group_id,
    591         'user_id' => $user_id,
    592     ) );
     588    if ( bp_is_active( 'activity' ) ) {
     589        groups_record_activity( array(
     590            'type'    => 'joined_group',
     591            'item_id' => $group_id,
     592            'user_id' => $user_id,
     593        ) );
     594    }
    593595
    594596    /**
Note: See TracChangeset for help on using the changeset viewer.