BuddyDev

Search

Members filters

  • Participant
    Level: Initiated
    Posts: 5
    Bilal on #47844

    Hello,

    I’ve added the search filters for the members in the group directory. I added this already But looks like it’s not working.

    please take a look at that.

    https://drive.google.com/file/d/12ENySmU_6SIYwL2cSAoRYc9gnhQc4Yyo/view?usp=share_link

    Thank you

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #47845

    Hi Bilal,
    Are you using community Builder theme?

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 5
    Bilal on #47850
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #47851

    Hi Bilal,
    I am sorry, I lack the experience with Avada.
    I will suggest using Bp profile search plugin

    https://wordpress.org/plugins/bp-profile-search/

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 5
    Bilal on #47854
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #47879
    This reply has been marked as private.
  • Participant
    Level: Initiated
    Posts: 5
    Bilal on #47911
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #47961
    This reply has been marked as private.
  • Participant
    Level: Initiated
    Posts: 5
    Bilal on #48041

    Hi Brajesh,

    I hope you are doing well. can you please give me any update regarding the last topic? actually, it needs to do in little quickly. is there anything I can help you with?

    I’ve more code I created it. Can I send you if that works?

    Thank you!

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #48042

    Hi Bilal,
    Here is the code I can provide you.
    It won’t work unless you reach out to Andrea again for the help.

    
    
    // filter result and scope to current  group members.
    add_filter( 'bps_search_results', function ( $users ) {
    	if ( ! bp_is_group() ) {
    		return $users;
    	}
    	// find current group member ids
    	$member_ids = BP_Groups_Member::get_group_member_ids( groups_get_current_group()->id );
    
    	// we only show the results for the members who match the result and are a member.
    	return array_intersect( $member_ids, $users );
    } );
    
    // filter form action and make it use current page if we are on group.
    add_action( 'bps_before_search_form', function ( $form ) {
    	if ( bp_is_group() ) {
    		$form->action = "";
    	}
    
    	return $form;
    } );
    
    

    Here is the plan:-

    1. You put the BP Profile search form in group sidebar widget. We use the filter to scope results to group members

    2. To show result, you use [bps_directory] shortcode in the sidebar too. I have filtered the form action to submit it on the same page.

    The above code is not fully functional. It seems the directory shortcode is not working in group sidebar.

    Please reach out to Andrea and let me know her insights on this.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved