bps_get_request( $type,  $form )

Description

Source

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

	function bps_get_request( $type, $form = 0 ) {
		$current        = bps_current_page();
		$hidden_filters = bps_get_hidden_filters();

		$cookie  = apply_filters( 'bps_cookie_name', 'bps_request' );
		$request = isset ( $_REQUEST[ 'bps_form' ] ) ? $_REQUEST : array();
		if ( empty ( $request ) && isset ( $_COOKIE[ $cookie ] ) ) {
			parse_str( stripslashes( $_COOKIE[ $cookie ] ), $request );
		}

		switch ( $type ) {
			case 'form':
				if ( isset ( $request[ 'bps_form' ] ) && $request[ 'bps_form' ] != $form ) {
					$request = array();
				}
				break;

			case 'filters':
				if ( isset ( $request['bps_directory'] ) && $request['bps_directory'] != $current ) {
					$request = array();
				}
				foreach ( $hidden_filters as $key => $value ) {
					unset ( $request[ $key ] );
				}
				break;

			case 'search':
				if ( isset ( $request['bps_directory'] ) && $request['bps_directory'] != $current ) {
					$request = array();
				}
				foreach ( $hidden_filters as $key => $value ) {
					$request[ $key ] = $value;
				}
				break;
		}

		return apply_filters( 'bps_request', $request, $type, $form );
	}

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.