Changeset 10322 for trunk/src/bp-members/bp-members-admin.php
- Timestamp:
- 11/02/2015 01:58:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-admin.php
r10314 r10322 15 15 * Load Members admin area. 16 16 * 17 * @package BuddyPress18 * @subpackage membersAdministration19 *20 17 * @since 2.0.0 21 18 */ … … 103 100 104 101 // Paths and URLs 105 $this->admin_dir = trailingslashit( $bp->plugin_dir . 'bp-members/admin' ); // Admin path 106 $this->admin_url = trailingslashit( $bp->plugin_url . 'bp-members/admin' ); // Admin URL 107 $this->css_url = trailingslashit( $this->admin_url . 'css' ); // Admin CSS URL 108 $this->js_url = trailingslashit( $this->admin_url . 'js' ); // Admin CSS URL 109 110 // Capability depends on config 102 $this->admin_dir = trailingslashit( $bp->plugin_dir . 'bp-members/admin' ); // Admin path. 103 $this->admin_url = trailingslashit( $bp->plugin_url . 'bp-members/admin' ); // Admin URL. 104 $this->css_url = trailingslashit( $this->admin_url . 'css' ); // Admin CSS URL. 105 $this->js_url = trailingslashit( $this->admin_url . 'js' ); // Admin CSS URL. 106 107 // Capability depends on config. 111 108 $this->capability = bp_core_do_network_admin() ? 'manage_network_users' : 'edit_users'; 112 109 113 // The Edit Profile Screen id 110 // The Edit Profile Screen id. 114 111 $this->user_page = ''; 115 112 116 // The Show Profile Screen id 113 // The Show Profile Screen id. 117 114 $this->user_profile = is_network_admin() ? 'users' : 'profile'; 118 115 119 // The current user id 116 // The current user id. 120 117 $this->current_user_id = get_current_user_id(); 121 118 122 // The user id being edited 119 // The user id being edited. 123 120 $this->user_id = 0; 124 121 125 // Is a member editing their own profile 122 // Is a member editing their own profile. 126 123 $this->is_self_profile = false; 127 124 128 // The screen ids to load specific css for 125 // The screen ids to load specific css for. 129 126 $this->screen_id = array(); 130 127 131 // The stats metabox default position 128 // The stats metabox default position. 132 129 $this->stats_metabox = new StdClass(); 133 130 134 // BuddyPress edit user's profile args 131 // BuddyPress edit user's profile args. 135 132 $this->edit_profile_args = array( 'page' => 'bp-profile-edit' ); 136 133 $this->edit_profile_url = ''; 137 134 $this->edit_url = ''; 138 135 139 // Data specific to signups 136 // Data specific to signups. 140 137 $this->users_page = ''; 141 138 $this->signups_page = ''; … … 143 140 $this->users_screen = bp_core_do_network_admin() ? 'users-network' : 'users'; 144 141 145 // Specific config: BuddyPress is not network activated 142 // Specific config: BuddyPress is not network activated. 146 143 $this->subsite_activated = (bool) is_multisite() && ! bp_is_network_activated(); 147 144 148 // When BuddyPress is not network activated, only Super Admin can moderate signups 145 // When BuddyPress is not network activated, only Super Admin can moderate signups. 149 146 if ( ! empty( $this->subsite_activated ) ) { 150 147 $this->capability = 'manage_network_users'; … … 159 156 private function setup_actions() { 160 157 161 /** Extended Profile **************************************************/ 162 163 // Enqueue all admin JS and CSS 158 /** Extended Profile ************************************************* 159 */ 160 161 // Enqueue all admin JS and CSS. 164 162 add_action( 'bp_admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 165 163 166 // Add some page specific output to the <head> 164 // Add some page specific output to the <head>. 167 165 add_action( 'bp_admin_head', array( $this, 'admin_head' ), 999 ); 168 166 169 // Add menu item to all users menu 167 // Add menu item to all users menu. 170 168 add_action( 'admin_menu', array( $this, 'admin_menus' ), 5 ); 171 169 add_action( 'network_admin_menu', array( $this, 'admin_menus' ), 5 ); 172 170 add_action( 'user_admin_menu', array( $this, 'user_profile_menu' ), 5 ); 173 171 174 // Create the Profile Navigation (Profile/Extended Profile) 172 // Create the Profile Navigation (Profile/Extended Profile). 175 173 add_action( 'edit_user_profile', array( $this, 'profile_nav' ), 99, 1 ); 176 174 add_action( 'show_user_profile', array( $this, 'profile_nav' ), 99, 1 ); 177 175 178 // Editing users of a specific site 176 // Editing users of a specific site. 179 177 add_action( "admin_head-site-users.php", array( $this, 'profile_admin_head' ) ); 180 178 181 // Add a row action to users listing 179 // Add a row action to users listing. 182 180 if ( bp_core_do_network_admin() ) { 183 181 add_filter( 'ms_user_row_actions', array( $this, 'row_actions' ), 10, 2 ); … … 186 184 } 187 185 188 // Add user row actions for single site 186 // Add user row actions for single site. 189 187 add_filter( 'user_row_actions', array( $this, 'row_actions' ), 10, 2 ); 190 188 … … 192 190 add_action( 'bp_members_admin_load', array( $this, 'process_member_type_update' ) ); 193 191 194 /** Signups ***********************************************************/ 192 /** Signups ********************************************************** 193 */ 195 194 196 195 if ( is_admin() ) { 197 196 198 // Filter non multisite user query to remove sign-up users 197 // Filter non multisite user query to remove sign-up users. 199 198 if ( ! is_multisite() ) { 200 199 add_action( 'pre_user_query', array( $this, 'remove_signups_from_user_query' ), 10, 1 ); 201 200 } 202 201 203 // Reorganise the views navigation in users.php and signups page 202 // Reorganise the views navigation in users.php and signups page. 204 203 if ( current_user_can( $this->capability ) ) { 205 204 add_filter( "views_{$this->users_screen}", array( $this, 'signup_filter_view' ), 10, 1 ); … … 226 225 $this->user_id = (int) get_current_user_id(); 227 226 228 // We'll need a user ID when not on self profile 227 // We'll need a user ID when not on self profile. 229 228 if ( ! empty( $_GET['user_id'] ) ) { 230 229 $this->user_id = (int) $_GET['user_id']; … … 237 236 * Can the current user edit the one displayed. 238 237 * 239 * self profile editing / or bp_moderate check.238 * Self profile editing / or bp_moderate check. 240 239 * This might be replaced by more granular capabilities 241 240 * in the future. … … 250 249 $retval = false; 251 250 252 // Bail if no user ID was passed 251 // Bail if no user ID was passed. 253 252 if ( empty( $user_id ) ) { 254 253 return $retval; 255 254 } 256 255 257 // Member can edit if they are viewing their own profile 256 // Member can edit if they are viewing their own profile. 258 257 if ( $this->current_user_id === $user_id ) { 259 258 $retval = true; 260 259 261 // Trust the 'bp_moderate' capability 260 // Trust the 'bp_moderate' capability. 262 261 } else { 263 262 $retval = bp_current_user_can( 'bp_moderate' ); … … 276 275 private function get_user_notice() { 277 276 278 // Setup empty notice for return value 277 // Setup empty notice for return value. 279 278 $notice = array(); 280 279 281 // Updates 280 // Updates. 282 281 if ( ! empty( $_REQUEST['updated'] ) ) { 283 282 switch ( $_REQUEST['updated'] ) { … … 309 308 } 310 309 311 // Errors 310 // Errors. 312 311 if ( ! empty( $_REQUEST['error'] ) ) { 313 312 switch ( $_REQUEST['error'] ) { … … 363 362 public function user_profile_menu() { 364 363 365 // Setup the hooks array 364 // Setup the hooks array. 366 365 $hooks = array(); 367 366 368 // Add the faux "Edit Profile" submenu page 367 // Add the faux "Edit Profile" submenu page. 369 368 $hooks['user'] = $this->user_page = add_submenu_page( 370 369 'profile.php', … … 376 375 ); 377 376 378 // Setup the screen ID's 377 // Setup the screen ID's. 379 378 $this->screen_id = array( 380 379 $this->user_page . '-user', … … 382 381 ); 383 382 384 // Loop through new hooks and add method actions 383 // Loop through new hooks and add method actions. 385 384 foreach ( $hooks as $key => $hook ) { 386 385 add_action( "load-{$hook}", array( $this, $key . '_admin_load' ) ); 387 386 } 388 387 389 // Add the profile_admin_head method to proper admin_head actions 388 // Add the profile_admin_head method to proper admin_head actions. 390 389 add_action( "admin_head-{$this->user_page}", array( $this, 'profile_admin_head' ) ); 391 390 add_action( "admin_head-profile.php", array( $this, 'profile_admin_head' ) ); … … 401 400 public function admin_menus() { 402 401 403 // Setup the hooks array 402 // Setup the hooks array. 404 403 $hooks = array(); 405 404 406 // Manage user's profile 405 // Manage user's profile. 407 406 $hooks['user'] = $this->user_page = add_submenu_page( 408 407 $this->user_profile . '.php', … … 414 413 ); 415 414 416 // Only show sign-ups where they belong 415 // Only show sign-ups where they belong. 417 416 if ( ! is_multisite() || is_network_admin() ) { 418 417 419 // Manage signups 418 // Manage signups. 420 419 $hooks['signups'] = $this->signups_page = add_users_page( 421 420 __( 'Manage Signups', 'buddypress' ), … … 431 430 $this->users_page = 'users'; 432 431 433 // Self profile check is needed for this pages 432 // Self profile check is needed for this pages. 434 433 $page_head = array( 435 434 $edit_page . '.php', … … 439 438 ); 440 439 441 // Append '-network' to each array item if in network admin 440 // Append '-network' to each array item if in network admin. 442 441 if ( is_network_admin() ) { 443 442 $edit_page .= '-network'; … … 448 447 } 449 448 450 // Setup the screen ID's 449 // Setup the screen ID's. 451 450 $this->screen_id = array( 452 451 $edit_page, … … 455 454 ); 456 455 457 // Loop through new hooks and add method actions 456 // Loop through new hooks and add method actions. 458 457 foreach ( $hooks as $key => $hook ) { 459 458 add_action( "load-{$hook}", array( $this, $key . '_admin_load' ) ); 460 459 } 461 460 462 // Add the profile_admin_head method to proper admin_head actions 461 // Add the profile_admin_head method to proper admin_head actions. 463 462 foreach ( $page_head as $head ) { 464 463 add_action( "admin_head-{$head}", array( $this, 'profile_admin_head' ) ); … … 478 477 $this->is_self_profile = true; 479 478 480 // Is the user attempting to edit their own profile 479 // Is the user attempting to edit their own profile. 481 480 } elseif ( isset( $_GET['user_id' ] ) || ( isset( $_GET['page'] ) && ( 'bp-profile-edit' === $_GET['page'] ) ) ) { 482 481 $this->is_self_profile = (bool) ( $this->get_user_id() === $this->current_user_id ); … … 490 489 } 491 490 492 // Editing your own profile, so recheck some vars 491 // Editing your own profile, so recheck some vars. 493 492 if ( true === $this->is_self_profile ) { 494 493 495 // Use profile.php as the edit page 494 // Use profile.php as the edit page. 496 495 $edit_page = 'profile.php'; 497 496 498 // Set profile.php as the parent & sub files to correct the menu nav 497 // Set profile.php as the parent & sub files to correct the menu nav. 499 498 if ( is_blog_admin() || is_user_admin() ) { 500 499 $parent_file = 'profile.php'; … … 502 501 } 503 502 504 // Not editing yourself, so use user-edit.php 503 // Not editing yourself, so use user-edit.php. 505 504 } else { 506 505 $edit_page = 'user-edit.php'; … … 566 565 } 567 566 568 // Only load JavaScript for BuddyPress profile 567 // Only load JavaScript for BuddyPress profile. 569 568 if ( get_current_screen()->id == $this->user_page ) { 570 569 $js = $this->js_url . "admin{$min}.js"; … … 599 598 * @param object|null $user User to create profile navigation for. 600 599 * @param string $active Which profile to highlight. 601 *602 600 * @return string 603 601 */ 604 602 public function profile_nav( $user = null, $active = 'WordPress' ) { 605 603 606 // Bail if no user ID exists here 604 // Bail if no user ID exists here. 607 605 if ( empty( $user->ID ) ) { 608 606 return; 609 607 } 610 608 611 // Add the user ID to query arguments when not editing yourself 609 // Add the user ID to query arguments when not editing yourself. 612 610 if ( false === $this->is_self_profile ) { 613 611 $query_args = array( 'user_id' => $user->ID ); … … 616 614 } 617 615 618 // Conditionally add a referer if it exists in the existing request 616 // Conditionally add a referer if it exists in the existing request. 619 617 if ( ! empty( $_REQUEST['wp_http_referer'] ) ) { 620 618 $query_args['wp_http_referer'] = urlencode( stripslashes_deep( $_REQUEST['wp_http_referer'] ) ); 621 619 } 622 620 623 // Setup the two distinct "edit" URL's 621 // Setup the two distinct "edit" URL's. 624 622 $community_url = add_query_arg( $query_args, $this->edit_profile_url ); 625 623 $wordpress_url = add_query_arg( $query_args, $this->edit_url ); … … 662 660 public function user_admin_load() { 663 661 664 // Get the user ID 662 // Get the user ID. 665 663 $user_id = $this->get_user_id(); 666 664 667 // can current user edit this profile?665 // Can current user edit this profile? 668 666 if ( ! $this->member_can_edit( $user_id ) ) { 669 667 wp_die( __( 'You cannot edit the requested user.', 'buddypress' ) ); 670 668 } 671 669 672 // Build redirection URL 670 // Build redirection URL. 673 671 $redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham', 'delete_avatar' ), $_SERVER['REQUEST_URI'] ); 674 672 $doaction = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : false; … … 701 699 $allowed_actions = apply_filters( 'bp_members_admin_allowed_actions', array( 'update', 'delete_avatar', 'spam', 'ham' ) ); 702 700 703 // Prepare the display of the Community Profile screen 701 // Prepare the display of the Community Profile screen. 704 702 if ( ! in_array( $doaction, $allowed_actions ) ) { 705 703 add_screen_option( 'layout_columns', array( 'default' => 2, 'max' => 2, ) ); … … 714 712 ) ); 715 713 716 // Help panel - sidebar links 714 // Help panel - sidebar links. 717 715 get_current_screen()->set_help_sidebar( 718 716 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' . … … 731 729 ); 732 730 733 // In case xprofile is not active 731 // In case xprofile is not active. 734 732 $this->stats_metabox->context = 'normal'; 735 733 $this->stats_metabox->priority = 'core'; … … 748 746 do_action_ref_array( 'bp_members_admin_xprofile_metabox', array( $user_id, get_current_screen()->id, $this->stats_metabox ) ); 749 747 750 // If xProfile is inactive, difficult to know what's profile we're on 748 // If xProfile is inactive, difficult to know what's profile we're on. 751 749 if ( 'normal' === $this->stats_metabox->context ) { 752 750 $display_name = bp_core_get_user_displayname( $user_id ); … … 755 753 } 756 754 757 // User Stat metabox 755 // User Stat metabox. 758 756 add_meta_box( 759 757 'bp_members_admin_user_stats', … … 793 791 do_action( 'bp_members_admin_user_metaboxes', $this->is_self_profile, $user_id ); 794 792 795 // Enqueue JavaScript files 793 // Enqueue JavaScript files. 796 794 wp_enqueue_script( 'postbox' ); 797 795 wp_enqueue_script( 'dashboard' ); 798 796 799 // Spam or Ham user 797 // Spam or Ham user. 800 798 } elseif ( in_array( $doaction, array( 'spam', 'ham' ) ) && empty( $this->is_self_profile ) ) { 801 799 … … 810 808 bp_core_redirect( $redirect_to ); 811 809 812 // Update other stuff once above ones are done 810 // Update other stuff once above ones are done. 813 811 } else { 814 812 $this->redirect = $redirect_to; … … 841 839 } 842 840 843 // Get the user ID 841 // Get the user ID. 844 842 $user_id = $this->get_user_id(); 845 843 $user = get_user_to_edit( $user_id ); 846 844 847 // Construct title 845 // Construct title. 848 846 if ( true === $this->is_self_profile ) { 849 847 $title = __( 'Profile', 'buddypress' ); … … 852 850 } 853 851 854 // Construct URL for form 852 // Construct URL for form. 855 853 $request_url = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham' ), $_SERVER['REQUEST_URI'] ); 856 854 $form_action_url = add_query_arg( 'action', 'update', $request_url ); … … 860 858 } 861 859 862 // Prepare notice for admin 860 // Prepare notice for admin. 863 861 $notice = $this->get_user_notice(); 864 862 … … 947 945 public function user_admin_status_metabox( $user = null ) { 948 946 949 // Bail if no user id or if the user has not activated their account yet 947 // Bail if no user id or if the user has not activated their account yet. 950 948 if ( empty( $user->ID ) ) { 951 949 return; 952 950 } 953 951 954 // Bail if user has not been activated yet (how did you get here?) 952 // Bail if user has not been activated yet (how did you get here?). 955 953 if ( isset( $user->user_status ) && ( 2 == $user->user_status ) ) : ?> 956 954 … … 966 964 <?php 967 965 968 // Get the spam status once here to compare against below 966 // Get the spam status once here to compare against below. 969 967 $is_spammer = bp_is_user_spammer( $user->ID ); 970 968 … … 989 987 <?php 990 988 991 // translators: Publish box date format, see http://php.net/date989 // Translators: Publish box date format, see http://php.net/date. 992 990 $datef = __( 'M j, Y @ G:i', 'buddypress' ); 993 991 $date = date_i18n( $datef, strtotime( $user->user_registered ) ); … … 1036 1034 public function user_admin_stats_metabox( $user = null ) { 1037 1035 1038 // Bail if no user ID 1036 // Bail if no user ID. 1039 1037 if ( empty( $user->ID ) ) { 1040 1038 return; 1041 1039 } 1042 1040 1043 // If account is not activated last activity is the time user registered 1041 // If account is not activated last activity is the time user registered. 1044 1042 if ( isset( $user->user_status ) && 2 == $user->user_status ) { 1045 1043 $last_active = $user->user_registered; 1046 1044 1047 // Account is activated, getting user's last activity 1045 // Account is activated, getting user's last activity. 1048 1046 } else { 1049 1047 $last_active = bp_get_user_last_activity( $user->ID ); … … 1057 1055 1058 1056 <?php 1059 // Loading other stats only if user has activated their account 1057 // Loading other stats only if user has activated their account. 1060 1058 if ( empty( $user->user_status ) ) { 1061 1059 … … 1148 1146 * @param array|string $actions WordPress row actions (edit, delete). 1149 1147 * @param object $user The object for the user row. 1150 *1151 1148 * @return array Merged actions. 1152 1149 */ 1153 1150 public function row_actions( $actions = '', $user = null ) { 1154 1151 1155 // Bail if no user ID 1152 // Bail if no user ID. 1156 1153 if ( empty( $user->ID ) ) { 1157 1154 return; 1158 1155 } 1159 1156 1160 // Setup args array 1157 // Setup args array. 1161 1158 $args = array(); 1162 1159 1163 // Add the user ID if it's not for the current user 1160 // Add the user ID if it's not for the current user. 1164 1161 if ( $user->ID !== $this->current_user_id ) { 1165 1162 $args['user_id'] = $user->ID; 1166 1163 } 1167 1164 1168 // Add the referer 1165 // Add the referer. 1169 1166 $args['wp_http_referer'] = urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ); 1170 1167 1171 // Add the "Extended" link if the current user can edit this user 1168 // Add the "Extended" link if the current user can edit this user. 1172 1169 if ( current_user_can( 'edit_user', $user->ID ) || bp_current_user_can( 'bp_moderate' ) ) { 1173 1170 1174 // Add query args and setup the Extended link 1171 // Add query args and setup the Extended link. 1175 1172 $edit_profile = add_query_arg( $args, $this->edit_profile_url ); 1176 1173 $edit_profile_link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $edit_profile ), esc_html__( 'Extended', 'buddypress' ) ); … … 1178 1175 /** 1179 1176 * Check the edit action is available 1180 * and preserve the order edit | profile | remove/delete 1177 * and preserve the order edit | profile | remove/delete. 1181 1178 */ 1182 1179 if ( ! empty( $actions['edit'] ) ) { … … 1189 1186 ); 1190 1187 1191 // If not available simply add the edit profile action 1188 // If not available simply add the edit profile action. 1192 1189 } else { 1193 1190 $new_edit_actions = array( 'edit-profile' => $edit_profile_link ); … … 1219 1216 * @param string $url Profile URL. 1220 1217 * @param int $user_id User ID. 1221 *1222 1218 * @return string 1223 1219 */ … … 1245 1241 * @since 2.0.0 1246 1242 * 1247 * @param int $value 1248 * @param string $option 1249 * @param int $new_value 1250 * 1243 * @param int $value Value for signup option. 1244 * @param string $option Value for the option key. 1245 * @param int $new_value Value for the saved option. 1251 1246 * @return int The pagination preferences. 1252 1247 */ … … 1256 1251 } 1257 1252 1258 // Per page 1253 // Per page. 1259 1254 $new_value = (int) $new_value; 1260 1255 if ( $new_value < 1 || $new_value > 999 ) { … … 1274 1269 * 1275 1270 * @param WP_User_Query $query The users query. 1276 *1277 1271 * @return WP_User_Query The users query without the signups. 1278 1272 */ … … 1280 1274 global $wpdb; 1281 1275 1282 // Bail if this is an ajax request 1276 // Bail if this is an ajax request. 1283 1277 if ( defined( 'DOING_AJAX' ) ) { 1284 1278 return; 1285 1279 } 1286 1280 1287 // Bail if updating BuddyPress 1281 // Bail if updating BuddyPress. 1288 1282 if ( bp_is_update() ) { 1289 1283 return; 1290 1284 } 1291 1285 1292 // Bail if there is no current admin screen 1286 // Bail if there is no current admin screen. 1293 1287 if ( ! function_exists( 'get_current_screen' ) || ! get_current_screen() ) { 1294 1288 return; 1295 1289 } 1296 1290 1297 // Get current screen 1291 // Get current screen. 1298 1292 $current_screen = get_current_screen(); 1299 1293 1300 // Bail if not on a users page 1294 // Bail if not on a users page. 1301 1295 if ( ! isset( $current_screen->id ) || $this->users_page !== $current_screen->id ) { 1302 1296 return; 1303 1297 } 1304 1298 1305 // Bail if already querying by an existing role 1299 // Bail if already querying by an existing role. 1306 1300 if ( ! empty( $query->query_vars['role'] ) ) { 1307 1301 return; … … 1317 1311 * 1318 1312 * @param array $views WP List Table views. 1319 *1320 1313 * @return array The views with the signup view added. 1321 1314 */ 1322 1315 public function signup_filter_view( $views = array() ) { 1323 1316 1324 // Remove the 'current' class from All if we're on the signups view 1317 // Remove the 'current' class from All if we're on the signups view. 1325 1318 if ( $this->signups_page == get_current_screen()->id ) { 1326 1319 $views['all'] = str_replace( 'class="current"', '', $views['all'] ); … … 1346 1339 * @param string $class The name of the class to use. 1347 1340 * @param string $required The parent class. 1348 * 1349 * @return WP_List_Table The List table. 1341 * @return WP_List_Table The List table. 1350 1342 */ 1351 1343 public static function get_list_table_class( $class = '', $required = '' ) { … … 1376 1368 global $bp_members_signup_list_table; 1377 1369 1378 // Build redirection URL 1370 // Build redirection URL. 1379 1371 $redirect_to = remove_query_arg( array( 'action', 'error', 'updated', 'activated', 'notactivated', 'deleted', 'notdeleted', 'resent', 'notresent', 'do_delete', 'do_resend', 'do_activate', '_wpnonce', 'signup_ids' ), $_SERVER['REQUEST_URI'] ); 1380 1372 $doaction = bp_admin_list_table_current_bulk_action(); … … 1399 1391 $allowed_actions = apply_filters( 'bp_signups_admin_allowed_actions', array( 'do_delete', 'do_activate', 'do_resend' ) ); 1400 1392 1401 // Prepare the display of the Community Profile screen 1393 // Prepare the display of the Community Profile screen. 1402 1394 if ( ! in_array( $doaction, $allowed_actions ) || ( -1 == $doaction ) ) { 1403 1395 … … 1408 1400 } 1409 1401 1410 // per_page screen option1402 // The per_page screen option. 1411 1403 add_screen_option( 'per_page', array( 'label' => _x( 'Pending Accounts', 'Pending Accounts per page (screen options)', 'buddypress' ) ) ); 1412 1404 … … 1432 1424 ) ); 1433 1425 1434 // Help panel - sidebar links 1426 // Help panel - sidebar links. 1435 1427 get_current_screen()->set_help_sidebar( 1436 1428 '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' . … … 1442 1434 } 1443 1435 1444 // Handle resent activation links 1436 // Handle resent activation links. 1445 1437 if ( 'do_resend' == $doaction ) { 1446 1438 1447 // nonce check1439 // Nonce check. 1448 1440 check_admin_referer( 'signups_resend' ); 1449 1441 … … 1469 1461 bp_core_redirect( $redirect_to ); 1470 1462 1471 // Handle activated accounts 1463 // Handle activated accounts. 1472 1464 } elseif ( 'do_activate' == $doaction ) { 1473 1465 1474 // nonce check1466 // Nonce check. 1475 1467 check_admin_referer( 'signups_activate' ); 1476 1468 … … 1496 1488 bp_core_redirect( $redirect_to ); 1497 1489 1498 // Handle sign-ups delete 1490 // Handle sign-ups delete. 1499 1491 } elseif ( 'do_delete' == $doaction ) { 1500 1492 1501 // nonce check1493 // Nonce check. 1502 1494 check_admin_referer( 'signups_delete' ); 1503 1495 … … 1523 1515 bp_core_redirect( $redirect_to ); 1524 1516 1525 // Plugins can update other stuff from here 1517 // Plugins can update other stuff from here. 1526 1518 } else { 1527 1519 $this->redirect = $redirect_to; … … 1550 1542 public function signups_display_errors() { 1551 1543 1552 // Look for sign-up errors 1544 // Look for sign-up errors. 1553 1545 $errors = get_transient( '_bp_admin_signups_errors' ); 1554 1546 1555 // Bail if no activation errors 1547 // Bail if no activation errors. 1556 1548 if ( empty( $errors ) ) { 1557 1549 return; 1558 1550 } 1559 1551 1560 // Loop through errors and display them 1552 // Loop through errors and display them. 1561 1553 foreach ( $errors as $error ) : ?> 1562 1554 … … 1565 1557 <?php endforeach; 1566 1558 1567 // Delete the redirect transient 1559 // Delete the redirect transient. 1568 1560 delete_transient( '_bp_admin_signups_errors' ); 1569 1561 } … … 1578 1570 private function get_signup_notice() { 1579 1571 1580 // Setup empty notice for return value 1572 // Setup empty notice for return value. 1581 1573 $notice = array(); 1582 1574 1583 // Updates 1575 // Updates. 1584 1576 if ( ! empty( $_REQUEST['updated'] ) ) { 1585 1577 switch ( $_REQUEST['updated'] ) { … … 1688 1680 } 1689 1681 1690 // Errors 1682 // Errors. 1691 1683 if ( ! empty( $_REQUEST['error'] ) ) { 1692 1684 switch ( $_REQUEST['error'] ) { … … 1733 1725 $doaction = bp_admin_list_table_current_bulk_action(); 1734 1726 1735 // Prepare notices for admin 1727 // Prepare notices for admin. 1736 1728 $notice = $this->get_signup_notice(); 1737 1729 1738 // Display notices 1730 // Display notices. 1739 1731 if ( ! empty( $notice ) ) : 1740 1732 if ( 'updated' === $notice['class'] ) : ?> … … 1760 1752 <?php endif; 1761 1753 1762 // Show the proper screen 1754 // Show the proper screen. 1763 1755 switch ( $doaction ) { 1764 1756 case 'activate' : … … 1788 1780 $usersearch = ! empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; 1789 1781 1790 // Prepare the group items for display 1782 // Prepare the group items for display. 1791 1783 $bp_members_signup_list_table->prepare_items(); 1792 1784 … … 1843 1835 </h2> 1844 1836 1845 <?php // Display each signups on its own row ?>1837 <?php // Display each signups on its own row. ?> 1846 1838 <?php $bp_members_signup_list_table->views(); ?> 1847 1839 … … 1864 1856 * 1865 1857 * @param string $action Delete, activate, or resend activation link. 1866 *1867 1858 * @return string 1868 1859 */ … … 1872 1863 } 1873 1864 1874 // Get the user IDs from the URL 1865 // Get the user IDs from the URL. 1875 1866 $ids = false; 1876 1867 if ( ! empty( $_POST['allsignups'] ) ) { … … 1885 1876 1886 1877 // Query for signups, and filter out those IDs that don't 1887 // correspond to an actual signup 1878 // correspond to an actual signup. 1888 1879 $signups_query = BP_Signup::get( array( 1889 1880 'include' => $ids, … … 1893 1884 $signup_ids = wp_list_pluck( $signups, 'signup_id' ); 1894 1885 1895 // Set up strings 1886 // Set up strings. 1896 1887 switch ( $action ) { 1897 1888 case 'delete' : … … 1923 1914 } 1924 1915 1925 // These arguments are added to all URLs 1916 // These arguments are added to all URLs. 1926 1917 $url_args = array( 'page' => 'bp-signups' ); 1927 1918 1928 // These arguments are only added when performing an action 1919 // These arguments are only added when performing an action. 1929 1920 $action_args = array( 1930 1921 'action' => 'do_' . $action, … … 1987 1978 } 1988 1979 } 1989 endif; // class_exists check1990 1991 // Load the BP Members admin 1980 endif; // End class_exists check. 1981 1982 // Load the BP Members admin. 1992 1983 add_action( 'bp_init', array( 'BP_Members_Admin', 'register_members_admin' ) );
Note: See TracChangeset
for help on using the changeset viewer.