<p></p> <table id="grouptable" class="widefat fixed" cellspacing="0"> <thead> <tr class="thead"> <th class="id">id</th> <th class="name">Name</th> <th class="description">Description</th> <th class="user-count">Users</th> </tr> </thead> <tfoot> <tr class="thead"> <th class="id">id</th> <th class="name">Name</th> <th class="description">Description</th> <th class="user-count">Users</th> </tr> </tfoot> <tbody> <?php if (CTXPS_Queries::count_groups() == 0) { echo CTXPS_Components::render_group_list(); echo sprintf('<td colspan="4">' . __('You have not created any groups. Please <a href="%s">add a group</a>.', 'contexture-page-security') . '</td>', admin_url('users.php?page=ps_groups_add')); } else { echo CTXPS_Components::render_group_list(); } ?> </tbody> </table> </div>
</th> <th class="user-count"><?php _e('Users', 'contexture-page-security'); ?> </th> </tr> </thead> <tfoot> <tr class="thead"> <th class="id">id</th> <th class="name"><?php _e('Name', 'contexture-page-security'); ?> </th> <th class="description"><?php _e('Description', 'contexture-page-security'); ?> </th> <th class="user-count"><?php _e('Users', 'contexture-page-security'); ?> </th> </tr> </tfoot> <tbody> <?php echo CTXPS_Components::render_group_list($display_user, 'users', true, IS_PROFILE_PAGE); ?> </tbody> </table> </div>
/** * GROUP EDIT & USER PROFILE. Handles ajax requests to remove a group from a users account * * @global wpdb $wpdb */ public static function remove_group_from_user() { global $wpdb, $current_user; $response = array(); //Added in 1.1 - ensures current user is an admin before processing, else returns an error (probably not necessary - but just in case...) if (!current_user_can('promote_users')) { //ERROR! - membership not found. $response = new WP_Ajax_Response(array('what' => 'unenroll', 'action' => 'remove_group_from_user', 'id' => new WP_Error('error', __('User is not authorized.', 'contexture-page-security')))); $response->send(); } if (!CTXPS_Queries::delete_membership($_REQUEST['user_id'], $_REQUEST['group_id'])) { //Error - membership not found. $response = array('what' => 'unenroll', 'action' => 'remove_group_from_user', 'id' => new WP_Error('error', __('User not found in group.', 'contexture-page-security'))); } else { //SUCCESS! $response = array('what' => 'unenroll', 'action' => 'remove_group_from_user', 'id' => 1, 'data' => __('User removed from group.', 'contexture-page-security'), 'supplemental' => array('html' => CTXPS_Components::render_group_list($_REQUEST['user_id'], 'users', current_user_can('promote_users'), $_REQUEST['user_id'] == $current_user->ID))); } $response = new WP_Ajax_Response($response); $response->send(); }