Private Messages: Is it possible to have a joint inbox and sentbox
-
Hi guys,
My first time writing here – hoping someone can point me in the right direction:
I am using buddypress 1.9.2 with wordpress 3.8.1 (no link atm, as it is localhost).
Is it possible in any way to have a page showing both sent and received messages? Kind of like Facebook – if i’ve sent a message and there’s no reply yet, i will still see my own.
I’ve looked into bp_has_message_threads() in messages-loop.php, but there doesn’t seem to be an option to show &box=’all’ (only inbox, sentbox or notices.)
Really hoping someone has some input. Do I have to change the way the messages are stored perhaps?
-
The problem here is the
bp_has_message_threads()
function itself. It comes with hardcoded checks to override the$box
tosentbox
orinbox
based on the results ofbp_is_current_action()
.You could try something this, in lieu of
bp_has_message_threads()
:function bp_custom_has_message_threads( $args = '' ) { global $messages_template; $r = wp_parse_args( $args, array( 'user_id' => bp_loggedin_user_id(), 'box' => 'inbox', 'per_page' => 10, 'max' => false, 'type' => 'all', 'search_terms' => isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '', 'page_arg' => 'mpage', // See https://buddypress.trac.wordpress.org/ticket/3679 ) ); if ( bp_is_current_action( 'notices' ) && !bp_current_user_can( 'bp_moderate' ) ) { bp_core_redirect( bp_displayed_user_domain() ); } $messages_template = new BP_Messages_Box_Template( $r['user_id'], $r['box'], $r['per_page'], $r['max'], $r['type'], $r['search_terms'], $r['page_arg'] ); return apply_filters( 'bp_has_message_threads', $messages_template->has_threads(), $messages_template ); }
You may need to be crafty and override the
BP_Messages_Box_Template()
class too, as it contains more hardcoded assumptions about what box the user is looking at.Hmm…
yeah that’s what i thought. it might not be the easiest tasks.
It seems as if it would be something more people would have looked into, but I’ve searched high and low and no answers (or questions for that matter.)
Would you have any ideas as how to override
BP_Messages_Box_Template()
class?
- The topic ‘Private Messages: Is it possible to have a joint inbox and sentbox’ is closed to new replies.