>I also know the bp_get_member_user_id() is working perfectly inside the user-loop, so that shouldn’t be the issue either.
Classic mistake. Don’t assume – check it.
Create a string and echo it out.
$user_id = bp_get_member_user_id();
echo 'user_id: ' . $user_id;
$args = array(
'type' => 'alphabetical',
'user_id' => $user_id
);
if ( bp_has_groups ( $args ) ) { ...
Classic mistake. Don’t assume – check it.
No assumption, a fact. Like I said (and you quoted):
I also know the bp_get_member_user_id() is working perfectly inside the user-loop, so that shouldn’t be the issue either.
The code on that page looks roughly like this:
– if & while – members loop
– – Display Profile & xProfile data, using the bp_get_member_user_id() function to retrieve the userID (which I mentioned).
– – if & while – groups loop of that specific member
The last if & while (the groups loop) works perfectly on the default overview page, it’s displaying the groups for every member on their corresponding row in the html-table.
BUT: as soon I start searching (whether it’s the name of the member, or part of the address) the groups-loop stops working. All other things still work (Profile & xProfile field values are still getting displayed), but the groups-list per member doesn’t display anymore.
With checking on a per-group basis the same thing happens: on the overview page of that group it works perfectly, until I start searching: everything but the groups display.
What I completely forgot about: it’s also doing this with the groups-list I’m displaying on the top of the overview pages to filter the members per group. When on the all-overview page it’s displaying the groups fine, but once you start searching the only thing in that submenu/filtermenu is the All option.
I’d love to provide screenshots of this, but unfortunately I’m dealing with private information here, and very specific group-names, so I don’t want to display that here in the open.
You don’t state which version of BP you’re using.
>as soon I start searching (whether it’s the name of the member, or part of the address) the groups-loop stops working.
If I understand you correctly, bp_has_groups doesn’t ‘work’ if you include search terms.
Perhaps it is working but the search terms are not being found, so no groups are being returned.
I’m not positive, but I think the search is only on the name and description of a group.
Take a look at function search_groups in bp-groups-classes.php