Skip to:
Content

BuddyPress.org

Changeset 10907


Ignore:
Timestamp:
06/28/2016 05:24:26 AM (4 years ago)
Author:
r-a-y
Message:

Activity: Fix issue with activity permalink access when the legacy activity query is enabled.

In #7113, we fixed a bug where anybody's activity item could be displayed
under a member profile. The fix (r10880) does a strict type check on
$activity->user_id.

We expect $activity->user_id to be an integer, however it can be a
numeric string if the legacy activity query is enabled with:
add_filter( 'bp_use_legacy_activity_query', '__return_true' );

Since the check will always fail in this instance, members will not be able
to access activity permalinks.

We unfortunately missed this specific instance in r10853.

This commit addresses this problem.

See #6977. Fixes #7146 (2.6-branch).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/src/bp-activity/classes/class-bp-activity-activity.php

    r10858 r10907  
    614614            }
    615615
     616            // Integer casting for legacy activity query.
     617            foreach ( (array) $activities as $i => $ac ) {
     618                $activities[ $i ]->id                = (int) $ac->id;
     619                $activities[ $i ]->item_id           = (int) $ac->item_id;
     620                $activities[ $i ]->secondary_item_id = (int) $ac->secondary_item_id;
     621                $activities[ $i ]->user_id           = (int) $ac->user_id;
     622                $activities[ $i ]->hide_sitewide     = (int) $ac->hide_sitewide;
     623                $activities[ $i ]->mptt_left         = (int) $ac->mptt_left;
     624                $activities[ $i ]->mptt_right        = (int) $ac->mptt_right;
     625                $activities[ $i ]->is_spam           = (int) $ac->is_spam;
     626            }
     627
    616628        } else {
    617629            // Query first for activity IDs.
Note: See TracChangeset for help on using the changeset viewer.