Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/08/2017 02:09:08 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Intercept: first pass intercept API.

This change introduces 3 new functions for generating a default intercept value and comparing against it in specific places. If the return value differs from the default intercept value, we know that function call was intercepted by a filter, and that value will become the new return value without executing the remaining part of the function.

See #3184.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/extend/buddypress/functions.php

    r6674 r6751  
    794794        }
    795795
    796         /**
    797          * Overrides the formatted activity action new activity string.
    798          *
    799          * @since 2.6.0 bbPress (r6370)
    800          *
    801          * @param string               $activity_action Activity action string value
    802          * @param string               $type            The type of post. Expects `topic` or `reply`.
    803          * @param string               $action          The current action string.
    804          * @param BP_Activity_Activity $activity        The BuddyPress activity object.
    805          */
    806         if ( $pre = apply_filters( 'bbp_pre_format_activity_action_new_post', false, $type, $action, $activity ) ) {
    807                 return $pre;
     796        // Bail if intercepted
     797        $intercept = bbp_maybe_intercept( __FUNCTION__, func_get_args() );
     798        if ( bbp_is_intercepted( $intercept ) ) {
     799                return $intercept;
    808800        }
    809801
Note: See TracChangeset for help on using the changeset viewer.