#5071 closed defect (bug) (fixed)
BP User Query and management of the include argument
| Reported by: | imath | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | high | Milestone: | 1.8 |
| Component: | Friends | Version: | 1.8 |
| Severity: | critical | Keywords: | has-patch needs-testing |
| Cc: | trisha@… |
Description
Hi,
I think this trouble is really annoying, that's why, for the first time, i've put a high severity on a ticket.
I was testing the friends component, then i've noticed when going into my friendship requests page (siteurl.dev/members/imath/friends/requests/) that all the users of the blog where showing even if i hadn't ask them to become my friends. So i clicked on Accept friendship to see what would happened but as no user id is in the url, it triggers an error...
Then i added a friend and went on his request page and there i was the only one in his request list. So i accepted and as soon as i've reloaded the request page, all the users were showing again. Even the friend i've accepted, and the button Accept was back..
So i've searched and landed in BP_User_Query class where the include parameter of bp_has_members() is managed, and the problem seems to be there as with the use of !empty( $include ) at line 318 of bp-core-classes.php the $sqlwhere[] = 'u.user_id IN (0)' is never set. So the $sqlwhere only have 1 element : 'u.field_id = 1' and all the users are showing.
I've checked in 1.7 and saw that the condition was false !== $include, so the diff attached to this ticket is using this condition and it seems to solve the trouble in the member's request friendship page. But i don't know if this break something elsewhere, so i think this should be checked more deeply.
Attachments (1)
Change History (6)
#1
@
13 years ago
- Keywords 2nd-opinion removed
- Milestone Awaiting Review → 1.8
- Priority normal → high
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I've confirmed this. From what I can see, it only happens when the current user has zero real friendship requests. (In other words, if there is at least one legitimate request, the
bp_has_members()andBP_User_Querywill return the correct users.)