bb_gs_create_searchstring( type $user_id, type $posted_field_ids, type $errors, type $old_values, type $new_values )

Generate search string on profile update

Description

Parameters

$user_id

(type) (Required)

$posted_field_ids

(type) (Required)

$errors

(type) (Required)

$old_values

(type) (Required)

$new_values

(type) (Required)

Source

File: bp-search/bp-search-functions.php

function bb_gs_create_searchstring( $user_id, $posted_field_ids, $errors, $old_values, $new_values ) {

	if ( ! function_exists( 'bp_is_active' ) || ! bp_is_active( 'xprofile' ) ) {
		return;
	}

	$items_to_search = BP_Search::instance()->searchable_items;

	$search_string = '';

	foreach ( $new_values as $key => $value ) {

		if ( in_array( 'xprofile_field_' . $key, $items_to_search ) ) {
			$search_string = $search_string . ' ' . $value['value'];
		}

	}
	update_user_meta( $user_id, 'bbgs_search_string', $search_string );

}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.