bbp_get_sanitize_val( string $request = '', string $input_type = 'text' )

Return sanitized $_REQUEST value.

Description

Use the $input_type parameter to properly process the value. This ensures correct sanitization of the value for the receiving input.

Parameters

$request

(Optional) Name of $_REQUEST to look for

Default value: ''

$input_type

(Optional) Type of input. Default: text. Accepts: textarea|password|select|radio|checkbox

Default value: 'text'

Return

(string) Sanitized value ready for screen display

Source

File: bp-forums/common/template.php

	function bbp_get_sanitize_val( $request = '', $input_type = 'text' ) {

		// Check that requested
		if ( empty( $_REQUEST[$request] ) )
			return false;

		// Set request varaible
		$pre_ret_val = $_REQUEST[$request];

		// Treat different kinds of fields in different ways
		switch ( $input_type ) {
			case 'text'     :
			case 'textarea' :
				$retval = esc_attr( stripslashes( $pre_ret_val ) );
				break;

			case 'password' :
			case 'select'   :
			case 'radio'    :
			case 'checkbox' :
			default :
				$retval = esc_attr( $pre_ret_val );
				break;
		}

		return apply_filters( 'bbp_get_sanitize_val', $retval, $request, $input_type );
	}

Changelog

Changelog
Version Description
bbPress (r2815) 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.