BuddyDev

Search

Hide a member type in Profile Search Forms

  • Participant
    Level: Initiated
    Posts: 10
    Ramagu on #31134

    Hello,

    I have installed Profile Search Forms to put the search engine on the member pages. I have two members that I do want to appear in the member type dropdown but two others do not.

    I have disabled the options in the profiles I want to hide from “List in directory?” and activated “Exclude members with this type from directory?”.

    The problem is that although users do not appear neither in the search nor in the list, the categories do appear in the dropdown.

    What can I do to get them covered?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #31151

    Hello Ramon,

    Thank you for posting. Please let me know do you want to hide some member-types from member type dropdown generated by the Profile search form.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 10
    Ramagu on #31154

    That’s right, I want to hide two types of search form members

    Thank you

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #31157

    Hello Ramon,

    Thank you for the acknowledgement. Please try the following code to exclude specfic member-types from member directory search form field I am supposing you are using “BP Profile Search”

    
    
    /**
     * Excluded member type form form
     *
     * @return array
     */
    function buddydev_search_excluded_member_types() {
    	// Enter member type name you want to exclude.
    	return array( 'Teacher' );
    }
    
    add_action( 'bps_edit_field', function ( $field ) {
    
    	if ( 'bp_member_type' != $field->code || empty( $field->options ) ) {
    		return $field;
    	}
    
    	$field->options = array_diff( $field->options, buddydev_search_excluded_member_types() );
    } );
    
    

    Use this code in you bp-custom.php file and let me know if it works or not.

    Regards
    Ravi

    • This reply was modified 3 years, 10 months ago by Ravi.
  • Participant
    Level: Initiated
    Posts: 10
    Ramagu on #31159

    Hello,

    I can’t find the file that you indicate. bp-custom.php

    I have searched all the folders but I don’t know where it is.

    Thank you

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #31160

    Hello Ramon,

    Sorry for the inconvenience. Please look the following documentations

    https://codex.buddypress.org/themes/bp-custom-php/

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 10
    Ramagu on #31433

    Hello,

    Although I have hidden users, the type still appears in the search box drop-down.

    Is there a way to remove it?

    Thank you

  • Participant
    Level: Initiated
    Posts: 10
    Ramagu on #31467

    In addition to the search fields appearing on the form.

    The member type also appears in buddypress activity and as recently connected.

    How can I make it hidden from everywhere?

    Thank you

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

    Hi Ramon,
    Thank you for the reply.


    @ravisharma
    will be assisting you with it tomorrow.

    About activity stream:- The plugin doe snot hide any user from activity stream as there is no efficient way to do it.

    If you still want to do it, Ravi or I may be able to put some code in couple of days. Please let me know if you want to proceed with it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Ramagu on #31492

    Hello,

    I do not understand, a code to hide the types of members that continue to appear on the form or to hide the activity of some users?

You must be logged in to reply to this topic.

This topic is: not resolved