Skip to:
Content

BuddyPress.org

Changeset 6832


Ignore:
Timestamp:
03/03/2013 08:45:16 PM (12 years ago)
Author:
boonebgorges
Message:

Introduces bp_admin_list_table_current_bulk_action() and applies to group and activity admin pages

WP_List_Table pages have top and bottom bulk action dropdowns: 'action' and
'action2'. This changeset reconciles these two dropdowns on form submit.

See #4861

Hat tip to imath for original patch

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-admin.php

    r6676 r6832  
    183183    $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : 'min.';
    184184
    185     // Bottom bulk action hack
    186     if ( !empty( $_REQUEST['action2'] ) ) {
    187         $_REQUEST['action'] = $_REQUEST['action2'];
    188         unset( $_REQUEST['action2'] );
    189     }
    190 
    191     // Decide whether to load the index or edit screen
    192     $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
     185    $doaction = bp_admin_list_table_current_bulk_action();
    193186
    194187    // Call an action for plugins to hook in early
  • trunk/bp-core/admin/bp-core-functions.php

    r6785 r6832  
    604604    return $bp_menu_order;
    605605}
     606
     607/** Utility  *****************************************************************/
     608
     609/**
     610 * When using a WP_List_Table, get the currently selected bulk action
     611 *
     612 * WP_List_Tables have bulk actions at the top and at the bottom of the tables,
     613 * and the inputs have different keys in the $_REQUEST array. This function
     614 * reconciles the two values and returns a single action being performed.
     615 *
     616 * @since BuddyPress (1.7)
     617 * @return string
     618 */
     619function bp_admin_list_table_current_bulk_action() {
     620
     621    $action = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
     622
     623    // If the bottom is set, let it override the action
     624    if ( ! empty( $_REQUEST['action2'] ) && $_REQUEST['action2'] != "-1" ) {
     625        $action = $_REQUEST['action2'];
     626    }
     627
     628    return $action;
     629}
  • trunk/bp-groups/bp-groups-admin.php

    r6830 r6832  
    7676    $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : 'min.';
    7777
    78     // Bottom bulk action hack
    79     if ( !empty( $_REQUEST['action2'] ) ) {
    80         $_REQUEST['action'] = $_REQUEST['action2'];
    81         unset( $_REQUEST['action2'] );
    82     }
    83 
    84     // Decide whether to load the index or edit screen
    85     $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
     78    $doaction = bp_admin_list_table_current_bulk_action();
    8679
    8780    // Call an action for plugins to hook in early
Note: See TracChangeset for help on using the changeset viewer.