Skip to:
Content

BuddyPress.org

Changeset 6667


Ignore:
Timestamp:
12/25/2012 09:55:42 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Introduce bp_deregister_template_stack() to allow manipulating of the template stack at run-time. See #4656.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template-loader.php

    r6537 r6667  
    107107 * @since BuddyPress (1.7)
    108108 *
    109  * @param string $location Callback function that returns the
     109 * @param string $location Callback function that returns the stack location
    110110 * @param int $priority
    111111 */
     
    117117
    118118    // Add location callback to template stack
    119     add_filter( 'bp_template_stack', $location_callback, (int) $priority );
     119    return add_filter( 'bp_template_stack', $location_callback, (int) $priority );
     120}
     121
     122/**
     123 * Deregisters a previously registered template stack location.
     124 *
     125 * @since BuddyPress (1.7)
     126 *
     127 * @param string $location Callback function that returns the stack location
     128 * @param int $priority
     129 * @see bp_register_template_stack()
     130 */
     131function bp_deregister_template_stack( $location_callback = '', $priority = 10 ) {
     132
     133    // Bail if no location, or function does not exist
     134    if ( empty( $location_callback ) || ! function_exists( $location_callback ) )
     135        return false;
     136
     137    // Add location callback to template stack
     138    return remove_filter( 'bp_template_stack', $location_callback, (int) $priority );
    120139}
    121140
Note: See TracChangeset for help on using the changeset viewer.