Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Miguel López

    (@atallos)

    Sorry, I don’t understand your question. Can you give me more details?

    Thread Starter TNELN

    (@tingaliin)

    When I make a field visible for “nobody” I still can find it with search. For instance I can search a user with his/her phone number.

    Plugin Author Miguel López

    (@atallos)

    I had not thought about this when I created Nobody visibility… You’re right, but I believe I can’t solve it.

    I’ve been searching in buddypress code where they do the search and there is no filter to modify the query… So the only way I think will be modify buddypress plugin…

    If you want to modify it inside buddypress, the file is:buddypress/bp-core/bp-core-classes.php. Line 364.

    /** Search Terms ******************************************************/
    
    		// 'search_terms' searches the xprofile fields
    		// To avoid global joins, do a separate query
    		// @todo remove need for bp_is_active() check
    		if ( false !== $search_terms && bp_is_active( 'xprofile' ) ) {
    			$search_terms_clean = mysql_real_escape_string( mysql_real_escape_string( $search_terms ) );
    			$search_terms_clean = like_escape( $search_terms_clean );
    			$found_user_ids_query = "SELECT user_id FROM {$bp->profile->table_name_data} WHERE value LIKE '%" . $search_terms_clean . "%'";
    			$found_user_ids = $wpdb->get_col( $found_user_ids_query );
    
    			if ( ! empty( $found_user_ids ) ) {
    				$sql['where'][] = "u.{$this->uid_name} IN (" . implode( ',', wp_parse_id_list( $found_user_ids ) ) . ")";
    			} else {
    				$sql['where'][] = $this->no_results['where'];
    			}
    		}

    You need to change the query to avoid searching in the fields with nobody visibility.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide search results’ is closed to new replies.