bb_gs_create_group_searchstring( type $groupid )

Generate search string on group update.

Description

Parameters

$groupid

(Required)

Source

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

function bb_gs_create_group_searchstring( $groupid ) {

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

	if ( empty( $groupid ) ) {
		global $bp;
		$groupid = $bp->groups->new_group_id;
	}

	$address = isset( $_POST['bpla-group-address'] ) ? $_POST['bpla-group-address'] : '';
	$street  = isset( $_POST['bpla-group-street'] ) ? $_POST['bpla-group-street'] : '';
	$city    = isset( $_POST['bpla-group-city'] ) ? $_POST['bpla-group-city'] : '';
	$state   = isset( $_POST['bpla-group-state'] ) ? $_POST['bpla-group-state'] : '';
	$zip     = isset( $_POST['bpla-group-zip'] ) ? $_POST['bpla-group-zip'] : '';
	$country = isset( $_POST['bpla-group-country'] ) ? $_POST['bpla-group-country'] : '';

	if ( $address ) {
		groups_update_groupmeta( $groupid, 'bbgs_group_search_string', $address );
	}
	if ( $street ) {
		groups_update_groupmeta( $groupid, 'bbgs_group_search_string', $address . ' ' . $street );
	}
	if ( $city ) {
		groups_update_groupmeta( $groupid, 'bbgs_group_search_string', $address . ' ' . $street . ' ' . $city );
	}
	if ( $state ) {
		groups_update_groupmeta( $groupid, 'bbgs_group_search_string', $address . ' ' . $street . ' ' . $city . ' ' . $state );
	}
	if ( $zip ) {
		groups_update_groupmeta( $groupid, 'bbgs_group_search_string', $address . ' ' . $street . ' ' . $city . ' ' . $state . ' ' . $zip );
	}
	if ( $country ) {
		groups_update_groupmeta( $groupid, 'bbgs_group_search_string', $address . ' ' . $street . ' ' . $city . ' ' . $state . ' ' . $zip . ' ' . $country );
	}


}

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.