#9205 closed enhancement (fixed)
Move some BP_User_Query::populate_extras() properties to hooks
Reported by: | r-a-y | Owned by: | espellcaste |
---|---|---|---|
Milestone: | 15.0.0 | Priority: | normal |
Severity: | normal | Version: | 1.7 |
Component: | Core | Keywords: | dev-feedback has-patch |
Cc: |
Description
In BP_User_Query::populate_extras()
, we hook the XProfile component and Friends component to add in extra data to the user query results. See bp_xprofile_filter_user_query_populate_extras()
and bp_friends_filter_user_query_populate_extras()
.
However, we hardcode the last activity timestamp, total friend count, last activity update and meta_key/meta_value (if passed) to the user query results. What if we do not want to query and return these items to the user results?
This patch moves the hardcoded items to hooks, so it is possible for developers to remove some of these fetched properties from the BP user query.
Attachments (1)
Change History (11)
#2
@
2 months ago
- Keywords changes-requested added
- Milestone changed from Awaiting Review to Up Next
I'm bumping this ticket to the next version only because we plan to release BP 14.0 in 5 days. But @imath can decide here if we can add it now. Seems low risk to me.
#3
@
2 months ago
Hi @r-a-y & @espellcaste
Thanks a lot for your contributions, I agree with @espellcaste let’s take some more time to work on it during next release 👍
#6
in reply to:
↑ 5
@
5 weeks ago
Replying to espellcaste:
@r-a-y I can make the changes, if you want. What do you think?
Feel free to make the changes, espellcaste!
A nice addition.
Only two suggestions comes to mind:
Add
@global wpdb $wpdb WordPress database object.
to the newbp_members_filter_user_query_populate_extras_meta
function.And change the references from
add_filter
toadd_action
since you are modifying the user query but not returning anything. This "issue" is true to the examples you shared too. See.It's true that it works as is but it is semantically incorrect.