Example #1
0
}
$pagenum = $pp_groups_list_table->get_pagenum();
// contextual help - choose Help on the top right of admin panel to preview this.
/*
add_contextual_help($current_screen,
    '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '</p>' .
    '<p>' . __('You can customize the display of information on this screen as you can on other screens, by using the Screen Options tab and the on-screen filters.') . '</p>' .
    '<p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>' .
    '<p><strong>' . __('For more information:') . '</strong></p>' .
    '<p>' . __('<a href="http://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
    '<p>' . __('<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
    '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
);
*/
$url = $referer = $redirect = $update = '';
PP_Permits_Helper::get_url_properties($url, $referer, $redirect);
if (!empty($_REQUEST['action2']) && !is_numeric($_REQUEST['action2'])) {
    $action = $_REQUEST['action2'];
} elseif (!empty($_REQUEST['action']) && !is_numeric($_REQUEST['action'])) {
    $action = $_REQUEST['action'];
} elseif (!empty($_REQUEST['pp_action'])) {
    $action = $_REQUEST['pp_action'];
} else {
    $action = '';
}
switch ($action) {
    //switch ( $pp_groups_list_table->current_action() ) {
    case 'delete':
    case 'bulkdelete':
        if (empty($_REQUEST['groups'])) {
            $groupids = array(intval($_REQUEST['group']));
Example #2
0
 public static function handle_request()
 {
     global $pp_admin;
     $url = $referer = $redirect = $update = '';
     PP_Permits_Helper::get_url_properties($url, $referer, $redirect);
     if (!($agent_type = apply_filters('pp_query_group_type', ''))) {
         $agent_type = 'pp_group';
     }
     if (!empty($_REQUEST['action2']) && !is_numeric($_REQUEST['action2'])) {
         $action = $_REQUEST['action2'];
     } elseif (!empty($_REQUEST['action']) && !is_numeric($_REQUEST['action'])) {
         $action = $_REQUEST['action'];
     } elseif (!empty($_REQUEST['pp_action'])) {
         $action = $_REQUEST['pp_action'];
     } else {
         $action = '';
     }
     switch ($action) {
         case 'dodelete':
             check_admin_referer('delete-groups');
             if (!current_user_can('pp_delete_groups')) {
                 wp_die(__('You are not permitted to do that.', 'pp'));
             }
             if (empty($_REQUEST['groups']) && empty($_REQUEST['group'])) {
                 wp_redirect($redirect);
                 exit;
             }
             if (empty($_REQUEST['groups'])) {
                 $groupids = array(intval($_REQUEST['group']));
             } else {
                 $groupids = (array) $_REQUEST['groups'];
             }
             $update = 'del';
             $delete_ids = array();
             foreach ((array) $groupids as $id) {
                 $id = (int) $id;
                 if ($group_obj = pp_get_group($id, $agent_type)) {
                     if (!empty($group->obj->metagroup_id)) {
                         continue;
                     }
                 }
                 //if ( ! current_user_can( 'pp_delete_groups', $id ) )
                 //	continue;
                 pp_delete_group($id, $agent_type);
                 $delete_ids[] = $id;
             }
             if (!$delete_ids) {
                 wp_die(__('You can&#8217;t delete that group.', 'pp'));
             }
             $redirect = add_query_arg(array('delete_count' => count($delete_ids), 'update' => $update), $redirect);
             wp_redirect($redirect);
             exit;
             break;
         case 'delete':
             check_admin_referer('bulk-groups');
             if (!current_user_can('pp_delete_groups')) {
                 wp_die(__('You are not permitted to do that.', 'pp'));
             }
             if (!empty($_REQUEST['groups'])) {
                 $redirect = esc_url_raw(add_query_arg(array('pp_action' => 'bulkdelete', 'agent_type' => $agent_type, 'wp_http_referer' => isset($_REQUEST['wp_http_referer']) ? $_REQUEST['wp_http_referer'] : '', 'groups' => $_REQUEST['groups']), $redirect));
                 wp_redirect($redirect);
                 exit;
             }
             if (empty($_REQUEST['group'])) {
                 // && empty($_REQUEST['user']) ) {
                 wp_redirect($redirect);
                 exit;
             }
             break;
         default:
     }
     // end switch
 }