Skip to:
Content

BuddyPress.org


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.