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-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        }
     
    8585
    8686        /**
    87          * Get the views (the links above the WP List Table).
    88          *
    89          * @since 2.0.0
    90          *
    91          * @uses WP_Users_List_Table::get_views() to get the users views.
    92          */
    93         public function get_views() {
    94                 return parent::get_views();
     87         * Display the users screen views
     88         *
     89         * @since 2.5.0
     90         *
     91         * @global string $role The name of role the users screens is filtered by
     92         */
     93        public function views() {
     94                global $role;
     95
     96                // Used to reset the role
     97                $reset_role = $role;
     98
     99                // Temporarly set the role to registered
     100                $role = 'registered';
     101
     102                // Used to reset the screen id once views are displayed
     103                $reset_screen_id = $this->screen->id;
     104
     105                // Temporarly set the screen id to the users one
     106                $this->screen->id = 'users';
     107
     108                // Use the parent function so that other plugins can safely add views
     109                parent::views();
     110
     111                // Reset the role
     112                $role = $reset_role;
     113
     114                // Reset the screen id
     115                $this->screen->id = $reset_screen_id;
    95116        }
    96117
Note: See TracChangeset for help on using the changeset viewer.