Changeset 6674
- Timestamp:
- 12/26/2012 09:17:49 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-admin.php
r6670 r6674 51 51 * @global object $bp BuddyPress global settings 52 52 * @global BP_Groups_List_Table $bp_groups_list_table Groups screen list table 53 * @since BuddyPress (1. 6)53 * @since BuddyPress (1.7) 54 54 */ 55 55 function bp_groups_admin_load() { … … 576 576 577 577 <a class="button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'do_delete', 'gid' => implode( ',', $gids ) ), $base_url ), 'bp-groups-delete' ) ?>"><?php _e( 'Delete Permanently', 'buddypress' ) ?></a> 578 <a class="button" href="<?php echo $base_url?>"><?php _e( 'Cancel', 'buddypress' ) ?></a>578 <a class="button" href="<?php echo esc_attr( $base_url ); ?>"><?php _e( 'Cancel', 'buddypress' ) ?></a> 579 579 </div> 580 580 … … 602 602 $messages[] = sprintf( _n( '%s activity has been permanently deleted.', '%s activity items have been permanently deleted.', $deleted, 'buddypress' ), number_format_i18n( $deleted ) ); 603 603 } 604 605 604 } 606 605 … … 609 608 610 609 // Call an action for plugins to modify the messages before we display the edit form 611 do_action( 'bp_groups_admin_index', $messages ); 612 ?> 610 do_action( 'bp_groups_admin_index', $messages ); ?> 613 611 614 612 <div class="wrap"> … … 648 646 */ 649 647 function bp_groups_admin_edit_metabox_settings( $item ) { 650 $invite_status = groups_get_groupmeta( $item->id, 'invite_status' ); 651 652 ?> 648 649 $invite_status = groups_get_groupmeta( $item->id, 'invite_status' ); ?> 653 650 654 651 <div class="bp-groups-settings-section" id="bp-groups-settings-section-forum"> … … 703 700 // javascript variable, which will help with group member autocomplete 704 701 $member_ids = array(); 705 $members = array(702 $members = array( 706 703 'admin' => array(), 707 704 'mod' => array(), … … 773 770 774 771 <tbody> 772 775 773 <?php foreach ( $type_users as $type_user ) : ?> 776 <?php $user_link = bp_core_get_user_domain( $type_user->user_id ); ?> 774 777 775 <tr> 778 <th scope="row" class="uid-column"><?php echo $type_user->user_id?></th>776 <th scope="row" class="uid-column"><?php echo esc_html( $type_user->user_id ); ?></th> 779 777 780 778 <td class="uname-column"> 781 <a style="float: left;" href="<?php echo $user_link?>"><?php echo bp_core_fetch_avatar( array(782 783 784 785 ) ) ?></a>779 <a style="float: left;" href="<?php echo bp_core_get_user_domain( $type_user->user_id ); ?>"><?php echo bp_core_fetch_avatar( array( 780 'item_id' => $type_user->user_id, 781 'width' => '32', 782 'height' => '32' 783 ) ); ?></a> 786 784 787 785 <span style="margin: 8px; float: left;"><?php echo bp_core_get_userlink( $type_user->user_id ) ?></span> … … 789 787 790 788 <td class="urole-column"> 791 <select class="bp-groups-role" id="bp-groups-role-<?php echo $type_user->user_id ?>" name="bp-groups-role[<?php echo $type_user->user_id?>]">789 <select class="bp-groups-role" id="bp-groups-role-<?php echo esc_attr( $type_user->user_id ); ?>" name="bp-groups-role[<?php echo esc_attr( $type_user->user_id ); ?>]"> 792 790 <option value="admin" <?php selected( 'admin', $member_type ) ?>><?php _e( 'Administrator', 'buddypress' ) ?></option> 793 791 <option value="mod" <?php selected( 'mod', $member_type ) ?>><?php _e( 'Moderator', 'buddypress' ) ?></option> … … 797 795 </select> 798 796 799 <?php /* Store the current role for this user, so we can easily detect changes */ ?> 800 <input type="hidden" name="bp-groups-existing-role[<?php echo $type_user->user_id ?>]" value="<?php echo $member_type ?>" /> 797 <?php 798 /** 799 * Store the current role for this user, 800 * so we can easily detect changes. 801 * 802 * @todo remove this, and do database detection on save 803 */ ?> 804 <input type="hidden" name="bp-groups-existing-role[<?php echo esc_attr( $type_user->user_id ); ?>]" value="<?php echo esc_attr( $member_type ); ?>" /> 801 805 </td> 802 806 </tr> 807 803 808 <?php endforeach; ?> 809 804 810 </tbody> 805 811 </table> … … 840 846 <div class="clear"></div> 841 847 </div><!-- #major-publishing-actions --> 842 843 848 </div><!-- #submitcomment --> 844 849 … … 851 856 * @since BuddyPress (1.7) 852 857 */ 853 function bp_groups_admin_get_usernames_from_ids( $user_ids ) { 858 function bp_groups_admin_get_usernames_from_ids( $user_ids = array() ) { 859 854 860 $usernames = array(); 855 856 $users = new WP_User_Query( array( 'blog_id' => 0, 'include' => $user_ids ) ); 857 foreach ( $users->results as $user ) {861 $users = new WP_User_Query( array( 'blog_id' => 0, 'include' => $user_ids ) ); 862 863 foreach ( (array) $users->results as $user ) { 858 864 $usernames[] = $user->user_login; 859 865 } … … 868 874 */ 869 875 function bp_groups_admin_autocomplete_handler() { 870 if ( ! current_user_can( 'bp_moderate' ) || is_multisite() && wp_is_large_network( 'users' ) ) 876 877 // Bail if user user shouldn't be here, or is a large network 878 if ( ! current_user_can( 'bp_moderate' ) || ( is_multisite() && wp_is_large_network( 'users' ) ) ) 871 879 wp_die( -1 ); 872 880 … … 875 883 // Exclude current group members 876 884 $group_members = isset( $_REQUEST['group_members'] ) ? wp_parse_id_list( $_REQUEST['group_members'] ) : array(); 877 878 $users = get_users( array(879 'blog_id' => false,880 'search' => '*' . $_REQUEST['term']. '*',881 'exclude' => $group_members,885 $terms = isset( $_REQUEST['term'] ) ? $_REQUEST['term'] : ''; 886 $users = get_users( array( 887 'blog_id' => false, 888 'search' => '*' . $terms . '*', 889 'exclude' => $group_members, 882 890 'search_columns' => array( 'user_login', 'user_nicename', 'user_email', 'display_name' ), 883 'number' => 10891 'number' => 10 884 892 ) ); 885 893 886 foreach ( $users as $user ) {894 foreach ( (array) $users as $user ) { 887 895 $return[] = array( 888 896 /* translators: 1: user_login, 2: user_email */ … … 899 907 * List table class for the Groups component admin page. 900 908 * 901 * @since BuddyPress (1. 6)909 * @since BuddyPress (1.7) 902 910 */ 903 911 class BP_Groups_List_Table extends WP_List_Table { … … 906 914 * What type of view is being displayed? e.g. "All", "Pending", "Approved", "Spam"... 907 915 * 908 * @since BuddyPress (1. 6)916 * @since BuddyPress (1.7) 909 917 */ 910 918 public $view = 'all'; … … 913 921 * Group counts for each group type 914 922 * 915 * @since BuddyPress (1. 6)923 * @since BuddyPress (1.7) 916 924 */ 917 925 public $group_counts = 0; … … 920 928 * Constructor 921 929 * 922 * @since BuddyPress (1. 6)930 * @since BuddyPress (1.7) 923 931 */ 924 932 public function __construct() { … … 935 943 * Handle filtering of data, sorting, pagination, and any other data-manipulation required prior to rendering. 936 944 * 937 * @since BuddyPress (1. 6)945 * @since BuddyPress (1.7) 938 946 */ 939 947 function prepare_items() { … … 943 951 944 952 // Option defaults 945 $include_id = false; 946 $search_terms = false; 947 $sort = 'DESC'; 953 $include_id = false; 954 $search_terms = false; 948 955 949 956 // Set current page … … 956 963 $order = 'ASC'; 957 964 if ( !empty( $_REQUEST['order'] ) ) { 958 $order = 'desc' == strtolower( $_REQUEST['order']) ? 'DESC' : 'ASC';965 $order = ( 'desc' == strtolower( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC'; 959 966 } 960 967 … … 1098 1105 * @since BuddyPress (1.7) 1099 1106 */ 1100 function single_row( $item ) {1107 function single_row( $item = array() ) { 1101 1108 static $row_class = ''; 1102 1109 1103 1110 if ( empty( $row_class ) ) { 1104 $row_class = ' class="alternate "';1111 $row_class = ' class="alternate odd"'; 1105 1112 } else { 1106 $row_class = ' ';1113 $row_class = ' class="even"'; 1107 1114 } 1108 1115 … … 1137 1144 */ 1138 1145 function get_bulk_actions() { 1139 $actions = array(); 1140 $actions['delete'] = __( 'Delete', 'buddypress' ); 1141 1142 return apply_filters( 'bp_groups_list_table_get_bulk_actions', $actions ); 1146 return apply_filters( 'bp_groups_list_table_get_bulk_actions', array( 1147 'delete' => __( 'Delete', 'buddypress' ) 1148 ) ); 1143 1149 } 1144 1150 … … 1153 1159 return array( 1154 1160 'cb' => '<input name type="checkbox" />', 1155 'comment' => _x( 'Name', 'Groups admin Group Name column header', 'buddypress' ),1161 'comment' => _x( 'Name', 'Groups admin Group Name column header', 'buddypress' ), 1156 1162 'description' => _x( 'Description', 'Groups admin Group Description column header', 'buddypress' ), 1157 'status' => _x( 'Status', 'Groups admin Privacy Status column header', 'buddypress' ),1158 'members' => _x( '# Members', 'Groups admin Members column header', 'buddypress' ),1159 'last_active' => _x( 'Last Active', 'Groups admin Last Active column header', 'buddypress' )1163 'status' => _x( 'Status', 'Groups admin Privacy Status column header', 'buddypress' ), 1164 'members' => _x( '# Members', 'Groups admin Members column header', 'buddypress' ), 1165 'last_active' => _x( 'Last Active', 'Groups admin Last Active column header', 'buddypress' ) 1160 1166 ); 1161 1167 } … … 1169 1175 function get_sortable_columns() { 1170 1176 return array( 1171 'gid' => array( 'gid', false ),1172 'comment' => array( 'name', false ),1173 'members' => array( 'members', false ),1177 'gid' => array( 'gid', false ), 1178 'comment' => array( 'name', false ), 1179 'members' => array( 'members', false ), 1174 1180 'last_active' => array( 'last_active', false ) 1175 1181 ); … … 1181 1187 * @param array $item A singular item (one full row) 1182 1188 * @see WP_List_Table::single_row_columns() 1183 * @since BuddyPress (1. 6)1184 */ 1185 function column_cb( $item ) {1189 * @since BuddyPress (1.7) 1190 */ 1191 function column_cb( $item = array() ) { 1186 1192 printf( '<input type="checkbox" name="gid[]" value="%d" />', (int) $item['id'] ); 1187 1193 } … … 1192 1198 * @param array $item A singular item (one full row) 1193 1199 * @see WP_List_Table::single_row_columns() 1194 * @since BuddyPress (1. 6)1195 */ 1196 function column_gid( $item ) {1200 * @since BuddyPress (1.7) 1201 */ 1202 function column_gid( $item = array() ) { 1197 1203 echo '<strong>' . $item['id'] . '</strong>'; 1198 1204 } … … 1207 1213 * @since BuddyPress (1.7) 1208 1214 */ 1209 function column_comment( $item ) {1215 function column_comment( $item = array() ) { 1210 1216 1211 1217 // Preorder items: Visit | Edit | Delete … … 1221 1227 // Build actions URLs 1222 1228 $base_url = bp_get_admin_url( 'admin.php?page=bp-groups&gid=' . $item['id'] ); 1223 1224 1229 $delete_url = wp_nonce_url( $base_url . "&action=delete", 'bp-groups-delete' ); 1225 1230 $edit_url = $base_url . '&action=edit'; … … 1262 1267 * @since BuddyPress (1.7) 1263 1268 */ 1264 function column_description( $item ) {1269 function column_description( $item = array() ) { 1265 1270 echo apply_filters_ref_array( 'bp_get_group_description', array( $item['description'], $item ) ); 1266 1271 } … … 1271 1276 * @since BuddyPress (1.7) 1272 1277 */ 1273 function column_status( $item ) { 1274 $status = $item['status']; 1275 1278 function column_status( $item = array() ) { 1279 $status = $item['status']; 1276 1280 $status_desc = ''; 1277 1281 … … 1298 1302 * @since BuddyPress (1.7) 1299 1303 */ 1300 function column_members( $item ) {1304 function column_members( $item = array() ) { 1301 1305 $count = groups_get_groupmeta( $item['id'], 'total_member_count' ); 1302 1306 echo apply_filters_ref_array( 'bp_groups_admin_get_group_member_count', array( (int) $count, $item ) ); … … 1308 1312 * @since BuddyPress (1.7) 1309 1313 */ 1310 function column_last_active( $item ) {1314 function column_last_active( $item = array() ) { 1311 1315 $last_active = groups_get_groupmeta( $item['id'], 'last_activity' ); 1312 1316 echo apply_filters_ref_array( 'bp_groups_admin_get_group_last_active', array( $last_active, $item ) );
Note: See TracChangeset
for help on using the changeset viewer.