Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/06/2012 10:29:35 AM (9 years ago)
Author:
johnjamesjacoby
Message:

Introduce bbp_post_request() and bbp_get_request() sub-actions:

  • Update actions and sub-actions to use these new handlers.
  • Update new/edit forum/topic/reply handlers to use these.
  • Update phpdoc as needed.
  • Remove duplicate 'bp_actions' request hooks from BuddyPress group forums.
  • Does not include admin-side requests.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/replies/functions.php

    r4522 r4551  
    7878 * @since bbPress (r2574)
    7979 *
     80 * @param string $action The requested action to compare this function to
    8081 * @uses bbp_add_error() To add an error message
    8182 * @uses bbp_verify_nonce_request() To verify the nonce and check the request
     
    103104 *                                              message
    104105 */
    105 function bbp_new_reply_handler() {
    106 
    107     // Bail if not a POST action
    108     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
    109         return;
     106function bbp_new_reply_handler( $action = '' ) {
    110107
    111108    // Bail if action is not bbp-new-reply
    112     if ( empty( $_POST['action'] ) || ( 'bbp-new-reply' !== $_POST['action'] ) )
     109    if ( 'bbp-new-reply' !== $action )
    113110        return;
    114111
     
    349346 * Handles the front end edit reply submission
    350347 *
     348 * @param string $action The requested action to compare this function to
    351349 * @uses bbp_add_error() To add an error message
    352350 * @uses bbp_get_reply() To get the reply
     
    376374 *                                             message
    377375 */
    378 function bbp_edit_reply_handler() {
    379 
    380     // Bail if not a POST action
    381     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
    382         return;
     376function bbp_edit_reply_handler( $action = '' ) {
    383377
    384378    // Bail if action is not bbp-edit-reply
    385     if ( empty( $_POST['action'] ) || ( 'bbp-edit-reply' !== $_POST['action'] ) )
     379    if ( 'bbp-edit-reply' !== $action )
    386380        return;
    387381
     
    10181012 * @since bbPress (r4521)
    10191013 *
     1014 * @param string $action The requested action to compare this function to
    10201015 * @uses bbPress:errors::add() To log various error messages
    10211016 * @uses bbp_get_reply() To get the reply
     
    10431038 * @uses wp_safe_redirect() To redirect to the topic link
    10441039 */
    1045 function bbp_move_reply_handler() {
    1046 
    1047     // Bail if not a POST action
    1048     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
    1049         return;
     1040function bbp_move_reply_handler( $action = '' ) {
    10501041
    10511042    // Bail if action is not 'bbp-move-reply'
    1052     if ( empty( $_POST['action'] ) || ( 'bbp-move-reply' !== $_POST['action'] ) )
     1043    if ( 'bbp-move-reply' !== $action )
    10531044        return;
    10541045
     
    13141305 * @since bbPress (r2740)
    13151306 *
     1307 * @param string $action The requested action to compare this function to
    13161308 * @uses bbp_get_reply() To get the reply
    13171309 * @uses current_user_can() To check if the user is capable of editing or
     
    13321324 * @uses bbPress::errors:add() To log the error messages
    13331325 */
    1334 function bbp_toggle_reply_handler() {
    1335 
    1336     // Bail if not a GET action
    1337     if ( 'GET' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
    1338         return;
     1326function bbp_toggle_reply_handler( $action = '' ) {
    13391327
    13401328    // Bail if required GET actions aren't passed
    1341     if ( empty( $_GET['reply_id'] ) || empty( $_GET['action'] ) )
     1329    if ( empty( $_GET['reply_id'] ) )
    13421330        return;
    13431331
     
    13491337
    13501338    // Bail if actions aren't meant for this function
    1351     if ( !in_array( $_GET['action'], $possible_actions ) )
     1339    if ( !in_array( $action, $possible_actions ) )
    13521340        return;
    13531341
    13541342    $failure   = '';                         // Empty failure string
    13551343    $view_all  = false;                      // Assume not viewing all
    1356     $action    = $_GET['action'];            // What action is taking place?
    13571344    $reply_id  = (int) $_GET['reply_id'];    // What's the reply id?
    13581345    $success   = false;                      // Flag
Note: See TracChangeset for help on using the changeset viewer.