Search messages by from/to username


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

This topic is: Not Resolved

This topic contains 5 replies, has 2 voices, and was last updated by  shamim 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #23346

    Al Nawras
    Participant

    Hi,

    How to accomplish a search for messages by username?

    #23368

    shamim
    Keymaster
    #23386

    Al Nawras
    Participant
    This reply has been marked as private.
    #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).

    #23483

    Al Nawras
    Participant

    unfortunately, it’s not working…

    #23489

    shamim
    Keymaster

    It is tested and working.
    Please go to Dashboard > Users > Your Profile > Name to see different type of names for you. You have to use Username (case sensitive) from there to search. Go to edit user page to get other users Username

Viewing 6 posts - 1 through 6 (of 6 total)

You need to purchase ‘Front End PM PRO’ to reply in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.