#5123 closed enhancement (fixed)
Add bp_the_thread_message_id() to bp-messages-template.php
Reported by: | dtc7240 | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Messages | Keywords: | has-patch |
Cc: |
Description
I had a need to get the actual message_id of a message in a thread and found no existing function to easily grab it. Can you please add the following bp_the_thread_message_id() function to the bottom of bp-messages-template.php, just after bp_the_thread_message_content()?
function bp_the_thread_message_id() { echo bp_get_the_thread_message_id(); } function bp_get_the_thread_message_id() { global $thread_template; return apply_filters( 'bp_get_the_thread_message_id', $thread_template->message->id ); }
I modeled it after the existing bp_the_thread_message_content() function:
function bp_the_thread_message_content() { echo bp_get_the_thread_message_content(); } function bp_get_the_thread_message_content() { global $thread_template; return apply_filters( 'bp_get_the_thread_message_content', $thread_template->message->message ); }
Many thanks,
Scott Seitz
Change History (4)
#2
@
11 years ago
- Owner set to boonebgorges
- Resolution set to fixed
- Status changed from new to closed
In 7329:
#3
@
11 years ago
Thanks Boone. Can we add an isset statement? I found that when submitting a message reply, it was throwing a 'Trying to get property of non-object' notice and I'd hate to gunk up people's debug logs...
function bp_the_thread_message_id() { echo bp_get_the_thread_message_id(); } function bp_get_the_thread_message_id() { global $thread_template; if ( isset( $thread_template->message->id ) ) return apply_filters( 'bp_get_the_thread_message_id', $thread_template->message->id ); }
Thanks again,
Scott
Looks good to me. Thanks for the patch.