Skip to:
Content

BuddyPress.org

Changeset 13326


Ignore:
Timestamp:
09/19/2022 11:05:29 PM (19 months ago)
Author:
imath
Message:

Improve the way we check the group context of logging activities

[13308] introduced a PHP warning due to a misuse of the
groups_get_current_group() function (my bad!). When no group is
displayed this function returns false, so checking if it's a
BP_Groups_Group object having an id property is wrong.

Fixes #8604

File:
1 edited

Legend:

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

    r13308 r13326  
    15691569            }
    15701570
    1571             if ( 'created_group' === $activity_type || 'joined_group' === $activity_type ) {
     1571            if ( bp_is_active( 'groups' ) && ( 'created_group' === $activity_type || 'joined_group' === $activity_type ) ) {
    15721572                $group         = bp_get_group( $activity->item_id );
    15731573                $current_group = groups_get_current_group();
    15741574
    15751575                // Do not use generated-content activities when displaying a group activity stream.
    1576                 if ( (int) $group->id === (int) $current_group->id ) {
     1576                if ( isset( $current_group->id ) && (int) $group->id === (int) $current_group->id ) {
    15771577                    return false;
    15781578                }
Note: See TracChangeset for help on using the changeset viewer.