Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Private Messages: Is it possible to have a joint inbox and sentbox

@johnjamesjacoby

Keymaster

The problem here is the bp_has_message_threads() function itself. It comes with hardcoded checks to override the $box to sentbox or inbox based on the results of bp_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 );
}
Skip to toolbar