_e('Name', 'contexture-page-security'); ?> </th> <th class="email"><?php _e('Email', 'contexture-page-security'); ?> </th> <th class="expires"><?php _e('Expires', 'contexture-page-security'); ?> </th> </tr> </tfoot> <tbody id="users" class="list:user user-list"> <?php echo CTXPS_Components::render_member_list($_GET['groupid']); ?> </tbody> </table> </form> <?php _e('<h3>Associated Content</h3>', 'contexture-page-security'); ?> <?php new CTXPS_Table_Packages('associated_content'); ?> <?php } } //ENDS : if (empty($groupInfo->group_title)) ?>
</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>
/** * Uses javascript to inject an AJAX-loaded bulk-add-to-group box to the Users list */ public static function js_userbulk_init() { ?> <script type="text/javascript"> jQuery(function(){ jQuery('.tablenav.top .alignleft.actions:last').after('<?php echo CTXPS_Components::render_bulk_add_to_group(); ?> '); }); </script> <?php }
<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>
public static function add_bulk_users_to_group() { $added_users = 0; //ERROR - No users selected! if (empty($_REQUEST['users'])) { $response = new WP_Ajax_Response(array('what' => 'bulk_enroll', 'action' => 'add_bulk_users_to_group', 'id' => new WP_Error('error', __('No users were selected.', 'contexture-page-security')), 'supplemental' => array('html' => CTXPS_Components::render_wp_message(__('No users were selected.', 'contexture-page-security'), 'error')))); $response->send(); } //ERROR - No group selected if (empty($_REQUEST['group_id'])) { $response = new WP_Ajax_Response(array('what' => 'bulk_enroll', 'action' => 'add_bulk_users_to_group', 'id' => new WP_Error('error', __('No group was selected.', 'contexture-page-security')), 'supplemental' => array('html' => CTXPS_Components::render_wp_message(__('No group was selected.', 'contexture-page-security'), 'error')))); $response->send(); } //Loop through all selected users... foreach ($_REQUEST['users'] as $user) { //Ensure users exists and is isnt already in group if (CTXPS_Queries::check_user_exists($user['value']) && !CTXPS_Queries::check_membership($user['value'], $_REQUEST['group_id'])) { //Try to add user if (CTXPS_Queries::add_membership($user['value'], $_REQUEST['group_id'])) { //increment for added users $added_users++; } } } $response = new WP_Ajax_Response(array('what' => 'bulk_enroll', 'action' => 'add_bulk_users_to_group', 'id' => 1, 'data' => '', 'supplemental' => array('html' => CTXPS_Components::render_wp_message(sprintf(__('%d users were enrolled.', 'contexture-page-security'), $added_users), 'updated fade')))); $response->send(); }