bp_ps_set_request()

Set BuddyBoss Profile Search request.

Description

Source

File: bp-core/profile-search/bps-search.php

function bp_ps_set_request ()
{
	global $post;
	global $shortcode_tags;

	if (isset ($post->post_type) && $post->post_type == 'page')
	{
		$saved_shortcodes = $shortcode_tags;
		$shortcode_tags = array ();
		add_shortcode ('bp_ps_directory', 'bp_ps_save_hidden_filters');
		do_shortcode ($post->post_content);
		$shortcode_tags = $saved_shortcodes;
	}

	$filters = bp_ps_hidden_filters ();
	if (!empty ($filters))
	{
		$cookie = apply_filters ('bp_ps_cookie_name', 'bp_ps_filters');
		setcookie ($cookie, http_build_query ($filters), 0, COOKIEPATH);
	}

	if (isset ($_REQUEST['bp_ps_debug']))
	{
		$cookie = apply_filters ('bp_ps_cookie_name', 'bp_ps_debug');
		setcookie ($cookie, 1, 0, COOKIEPATH);
	}

	$persistent = bp_ps_get_option ('persistent', '1');
	$new_search = isset ($_REQUEST[bp_core_get_component_search_query_arg ('members')]);

	if ($new_search || !$persistent)
		if (!isset ($_REQUEST[BP_PS_FORM]))  $_REQUEST[BP_PS_FORM] = 'clear';

	if (isset ($_REQUEST[BP_PS_FORM]))
	{
		$cookie = apply_filters ('bp_ps_cookie_name', 'bp_ps_request');
		if ($_REQUEST[BP_PS_FORM] != 'clear')
		{
			$_REQUEST['bp_ps_directory'] = bp_ps_current_page ();
			setcookie ($cookie, http_build_query ($_REQUEST), 0, COOKIEPATH);
		}
		else
		{
			setcookie ($cookie, '', 0, COOKIEPATH);
		}
	}
}

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.