Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/12/2016 06:22:37 AM (10 years ago)
Author:
imath
Message:

Signups Administration: improve the screen management

r10547 introduced some regressions by setting the screen ID to users or users-network :

  • It was not possible anymore to manage the displayed column inside the Screen options.
  • All costum columns added to the Users List Table using the filter manage_users_columns or manage_users-network_columns were also added to the Signups List Table.

To fix these and also make sure it is still possible to add custom views before and after the pending view, we are now using the Signups screen ID and introducing a new function to temporarly set the screen ID to users or users-network when needed.

Fixes #6872

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/classes/class-bp-members-ms-list-table.php

    r10547 r10579  
    3838            'plural'   => 'signups',
    3939            'singular' => 'signup',
    40             'screen'   => buddypress()->members->admin->users_screen,
     40            'screen'   => get_current_screen()->id,
    4141        ) );
    4242    }
     
    8686
    8787    /**
    88      * Get the views : the links above the WP List Table.
    89      *
    90      * @since 2.0.0
    91      *
    92      * @uses WP_MS_Users_List_Table::get_views() to get the users views.
    93      */
    94     public function get_views() {
    95         return parent::get_views();
     88     * Display the users screen views
     89     *
     90     * @since 2.5.0
     91     *
     92     * @global string $role The name of role the users screens is filtered by
     93     */
     94    public function views() {
     95        global $role;
     96
     97        // Used to reset the role
     98        $reset_role = $role;
     99
     100        // Temporarly set the role to registered
     101        $role = 'registered';
     102
     103        // Used to reset the screen id once views are displayed
     104        $reset_screen_id = $this->screen->id;
     105
     106        // Temporarly set the screen id to the users one
     107        $this->screen->id = 'users-network';
     108
     109        // Use the parent function so that other plugins can safely add views
     110        parent::views();
     111
     112        // Reset the role
     113        $role = $reset_role;
     114
     115        // Reset the screen id
     116        $this->screen->id = $reset_screen_id;
    96117    }
    97118
Note: See TracChangeset for help on using the changeset viewer.