[buddypress-trac] [BuddyPress Trac] #6431: get_group_extras function doesn't "respects" the user_id variable from groups_get_groups() function
buddypress-trac
noreply at wordpress.org
Tue Jan 5 15:51:00 UTC 2016
#6431: get_group_extras function doesn't "respects" the user_id variable from
groups_get_groups() function
----------------------------------------+------------------
Reporter: lenasterg | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.5
Component: Component - Groups | Version:
Severity: normal | Resolution:
Keywords: has-unit-tests needs-patch |
----------------------------------------+------------------
Changes (by boonebgorges):
* keywords: has-patch early has-unit-tests => has-unit-tests needs-patch
Comment:
Thanks for the patch, Mamaduka.
In `get_group_extras()`, you have:
{{{
$user_id = empty( $user_id ) ? bp_loggedin_user_id() : $user_id;
}}}
This makes it impossible to explicitly request group extras for user 0
when the current user is logged in. Let's do something more specific than
an `empty()` check - maybe `false === $user_id` (though we may also need
to support `null` because of upstream functions; please check this).
I think DJPaul is right that we need to reset the default values in each
iteration of the `foreach` loop. Say you have three groups 3, 6, and 10.
And assume that `is_banned = true` for group 3. Because the defaults are
not reset, the user will show as banned for 6 and 10 as well. This
probably ought to be demonstrated and guarded against with a unit test :)
Combining the `is_banned` query is clever. +1 from me.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6431#comment:9>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list