Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/09/2013 01:30:04 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Port request helper functions from bbPress, to be used as part of rewrite rules integration in a future release.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-dependency.php

    r7446 r7542  
    339339    return apply_filters( 'bp_allowed_themes', $themes );
    340340}
     341
     342/** Requests ******************************************************************/
     343
     344/**
     345 * The main action used for handling theme-side POST requests
     346 *
     347 * @since BuddyPress (1.9.0)
     348 * @uses do_action()
     349 */
     350function bp_post_request() {
     351
     352    // Bail if not a POST action
     353    if ( ! bp_is_post_request() )
     354        return;
     355
     356    // Bail if no action
     357    if ( empty( $_POST['action'] ) )
     358        return;
     359
     360    // This dynamic action is probably the one you want to use. It narrows down
     361    // the scope of the 'action' without needing to check it in your function.
     362    do_action( 'bp_post_request_' . $_POST['action'] );
     363
     364    // Use this static action if you don't mind checking the 'action' yourself.
     365    do_action( 'bp_post_request',   $_POST['action'] );
     366}
     367
     368/**
     369 * The main action used for handling theme-side GET requests
     370 *
     371 * @since BuddyPress (1.9.0)
     372 * @uses do_action()
     373 */
     374function bp_get_request() {
     375
     376    // Bail if not a POST action
     377    if ( ! bp_is_get_request() )
     378        return;
     379
     380    // Bail if no action
     381    if ( empty( $_GET['action'] ) )
     382        return;
     383
     384    // This dynamic action is probably the one you want to use. It narrows down
     385    // the scope of the 'action' without needing to check it in your function.
     386    do_action( 'bp_get_request_' . $_GET['action'] );
     387
     388    // Use this static action if you don't mind checking the 'action' yourself.
     389    do_action( 'bp_get_request',   $_GET['action'] );
     390}
Note: See TracChangeset for help on using the changeset viewer.