I had built some functionality into my widget which the stock BP who’s online didn’t incorporate. My code is actually pretty similar to the stock widgets in bp-core-widget, but yet I run into this issue where any other has_members query contaminates the contents of my widget. There must be some trick that I’m missing to initiate a has_members query that resets any pre-existing query…

Hey @jimmmy, I had forgotten about this issue. My new theme design only uses the has_members query once per page, as I had moved the “who’s online widget” on my site to a sidebar that is not displayed on other directories with members loops.

I’m not certain if this is still an issue or not, but one thing I suppose you could try is saving the contents of $members_template to a temporary placeholder variable before issuing your custom has_members query. Once you’ve run the loop on your secondary query you could restore the original contents of $members_template.

In case anyone is having the same problem, the solution i came up with was to make a plugin using the buddypress members widget core code, as @danbpfr suggested. That widget was not breaking things, so once i had a plugin version i was able to add some of the extra things that were in my original loop.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘[Resolved] Resetting a has_members query’ is closed to new replies.