Reply To: Search messages by from/to username


Home Forums Front End PM PRO Search messages by from/to username Reply To: Search messages by from/to username

#23407
shamim
Keymaster

You can add following code in your theme’s (child theme’s if you are using) functions.php

add_filter( 'fep_table_prepare_items_args', function( $args, $message_type ) {

	if( ! empty( $args['s'] )
	&& preg_match( '/^\S{4,}$/', trim( $args['s'] ) )
	&& ( $user = get_user_by( 'login', trim( $args['s'] ) ) )
	) {
		$args['participant_query'][] = array(
			'mgs_participant' => $user->ID,
		);
		unset( $args['s'] );
	}

	return $args;
}, 10, 2 );

It will match user_login (case sensitive).