bbp_maybe_intercept( string $action = '', array $args = array() )

Allow interception of a method or function call.


Description Description


Parameters Parameters

$action

(Optional) Typically the name of the caller function

Default value: ''

$args

(Optional) Typically the results of caller function func_get_args()

Default value: array()


Top ↑

Return Return

(mixed) Intercept results. Default bbp_default_intercept().


Top ↑

Source Source

File: includes/core/abstraction.php

function bbp_maybe_intercept( $action = '', $args = array() ) {

	// Backwards compatibility juggle
	$hook = ( false === strpos( $action, 'pre_' ) )
		? "pre_{$action}"
		: $action;

	// Default value
	$default = bbp_default_intercept();

	// Parse args
	$r = bbp_parse_args( (array) $args, array(), 'maybe_intercept' );

	// Bail if no args
	if ( empty( $r ) ) {
		return $default;
	}

	// Filter
	$args     = array_merge( array( $hook ), $r );
	$filtered = call_user_func_array( 'apply_filters', $args );

	// Return filtered value, or default if not intercepted
	return ( $filtered === reset( $r ) )
		? $default
		: $filtered;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.