Opened 4 years ago
Closed 3 years ago
#8293 closed enhancement (worksforme)
Add filter to allow manipulation of recipients in message thread
Reported by: | mangopeargroup | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | trivial | Version: | 5.2.0 |
Component: | Messages | Keywords: | |
Cc: |
Description
It would be quite useful to be able to manipulate the list of receipients shown on a message thread (i.e. adding additional data to array or amending the order of the list that's shown).
By adding a filter, we can manipulate the array of recipients before they're AJAX-ed to the template.
buddypress/bp-templates/bp-nouveau/includes/ajax.php
Line 460
return apply_filters( 'bp_get_user_message_threads_recipients', $thread->thread['recipients'] );
My use case is that I want to custom sort the list by user meta and I think this is the easiest, and best, way of doing so.
Change History (4)
#2
@
3 years ago
- Keywords needs-patch good-first-bug added
- Milestone changed from Awaiting Review to 10.0.0
Hi @mangopeargroup
I'm fine with adding this filter, but I'd like to see a patch about it. If you need some guidance about how to build a BP patch, please have a read at https://codex.buddypress.org/participate-and-contribute/contribute-with-code/
In your patch, please make sure to include proper inline documentation, see: https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#4-hooks-actions-and-filters
Whoops! Wrong filter format. Below is the correct format (I've tested it and it works).
buddypress/bp-templates/bp-nouveau/includes/ajax.php
Line 460
$thread->thread['recipients'] = apply_filters( 'bp_get_user_message_thread_recipients', $thread->thread['recipients'] );