Example #1
0
/**
 * The main action used for handling theme-side GET requests
 *
 * @since BuddyPress (1.9.0)
 * @uses do_action()
 */
function bp_get_request()
{
    // Bail if not a POST action
    if (!bp_is_get_request()) {
        return;
    }
    // Bail if no action
    if (empty($_GET['action'])) {
        return;
    }
    // This dynamic action is probably the one you want to use. It narrows down
    // the scope of the 'action' without needing to check it in your function.
    do_action('bp_get_request_' . $_GET['action']);
    // Use this static action if you don't mind checking the 'action' yourself.
    do_action('bp_get_request', $_GET['action']);
}
/**
 * The main action used for handling theme-side GET requests
 *
 * @since BuddyPress (1.9.0)
 * @uses do_action()
 */
function bp_get_request()
{
    // Bail if not a POST action
    if (!bp_is_get_request()) {
        return;
    }
    // Bail if no action
    if (empty($_GET['action'])) {
        return;
    }
    // Sanitize the GET action
    $action = sanitize_key($_GET['action']);
    /**
     * Fires at the end of the bp_get_request function.
     *
     * This dynamic action is probably the one you want to use. It narrows down
     * the scope of the 'action' without needing to check it in your function.
     *
     * @since BuddyPress (1.9.0)
     */
    do_action('bp_get_request_' . $action);
    /**
     * Fires at the end of the bp_get_request function.
     *
     * Use this static action if you don't mind checking the 'action' yourself.
     *
     * @since BuddyPress (1.9.0)
     *
     * @param string $action The action being run.
     */
    do_action('bp_get_request', $action);
}