Changeset 9668
- Timestamp:
- 03/31/2015 11:29:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-admin.php
r9639 r9668 22 22 function xprofile_add_admin_menu() { 23 23 24 if ( !bp_current_user_can( 'bp_moderate' ) ) 24 // Bail if current user cannot moderate community 25 if ( ! bp_current_user_can( 'bp_moderate' ) ) { 25 26 return false; 27 } 26 28 27 29 add_users_page( _x( 'Profile Fields', 'xProfile admin page title', 'buddypress' ), _x( 'Profile Fields', 'Admin Users menu', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' ); … … 37 39 $type = preg_replace( '|[^a-z]|i', '', $type ); 38 40 41 if ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && 'add_field' == $_GET['mode'] ) { 42 xprofile_admin_manage_field( $_GET['group_id'] ); 43 44 } elseif ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && isset( $_GET['field_id'] ) && 'edit_field' == $_GET['mode'] ) { 45 xprofile_admin_manage_field( $_GET['group_id'], $_GET['field_id'] ); 46 47 } elseif ( isset( $_GET['mode'] ) && isset( $_GET['field_id'] ) && 'delete_field' == $_GET['mode'] ) { 48 xprofile_admin_delete_field( $_GET['field_id'], 'field'); 49 50 } elseif ( isset( $_GET['mode'] ) && isset( $_GET['option_id'] ) && 'delete_option' == $_GET['mode'] ) { 51 xprofile_admin_delete_field( $_GET['option_id'], 'option' ); 52 53 } elseif ( isset( $_GET['mode'] ) && 'add_group' == $_GET['mode'] ) { 54 xprofile_admin_manage_group(); 55 56 } elseif ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && 'delete_group' == $_GET['mode'] ) { 57 xprofile_admin_delete_group( $_GET['group_id'] ); 58 59 } elseif ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && 'edit_group' == $_GET['mode'] ) { 60 xprofile_admin_manage_group( $_GET['group_id'] ); 61 62 } else { 63 xprofile_admin_screen( $message ); 64 } 65 } 66 67 /** 68 * Output the main XProfile management screen 69 * 70 * @since BuddyPress (2.3.0) 71 * 72 * @todo Improve error message output 73 */ 74 function xprofile_admin_screen( $message = '' ) { 75 76 // Get all of the profile groups & fields 39 77 $groups = bp_xprofile_get_groups( array( 40 78 'fetch_fields' => true 41 ) ); 42 43 if ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && 'add_field' == $_GET['mode'] ) 44 xprofile_admin_manage_field( $_GET['group_id'] ); 45 46 elseif ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && isset( $_GET['field_id'] ) && 'edit_field' == $_GET['mode'] ) 47 xprofile_admin_manage_field( $_GET['group_id'], $_GET['field_id'] ); 48 49 elseif ( isset( $_GET['mode'] ) && isset( $_GET['field_id'] ) && 'delete_field' == $_GET['mode'] ) 50 xprofile_admin_delete_field( $_GET['field_id'], 'field'); 51 52 elseif ( isset( $_GET['mode'] ) && isset( $_GET['option_id'] ) && 'delete_option' == $_GET['mode'] ) 53 xprofile_admin_delete_field( $_GET['option_id'], 'option' ); 54 55 elseif ( isset( $_GET['mode'] ) && 'add_group' == $_GET['mode'] ) 56 xprofile_admin_manage_group(); 57 58 elseif ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && 'delete_group' == $_GET['mode'] ) 59 xprofile_admin_delete_group( $_GET['group_id'] ); 60 61 elseif ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && 'edit_group' == $_GET['mode'] ) 62 xprofile_admin_manage_group( $_GET['group_id'] ); 63 64 else { ?> 79 ) ); ?> 65 80 66 81 <div class="wrap"> … … 203 218 204 219 <?php 205 }206 220 } 207 221 … … 226 240 $type = 'success'; 227 241 228 if ( 1 == $group_id ) 242 if ( 1 == $group_id ) { 229 243 bp_update_option( 'bp-xprofile-base-group-name', $group->name ); 244 } 230 245 231 246 /** … … 297 312 $field->type = wp_filter_kses( $_POST['fieldtype'] ); 298 313 299 if ( !empty( $_POST["sort_order_{$field->type}"] ) ) 314 if ( !empty( $_POST["sort_order_{$field->type}"] ) ) { 300 315 $field->order_by = wp_filter_kses( $_POST["sort_order_{$field->type}"] ); 316 } 301 317 302 318 $field->field_order = $wpdb->get_var( $wpdb->prepare( "SELECT field_order FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id ) ); … … 322 338 $type = 'success'; 323 339 324 if ( 1 == $field_id ) 340 if ( 1 == $field_id ) { 325 341 bp_update_option( 'bp-xprofile-fullname-field-name', $field->name ); 342 } 326 343 327 344 if ( !empty( $_POST['default-visibility'] ) ) { … … 402 419 check_admin_referer( 'bp_reorder_fields', '_wpnonce_reorder_fields' ); 403 420 404 if ( empty( $_POST['field_order'] ) ) 421 if ( empty( $_POST['field_order'] ) ) { 405 422 return false; 423 } 406 424 407 425 parse_str( $_POST['field_order'], $order ); … … 423 441 check_admin_referer( 'bp_reorder_groups', '_wpnonce_reorder_groups' ); 424 442 425 if ( empty( $_POST['group_order'] ) ) 443 if ( empty( $_POST['group_order'] ) ) { 426 444 return false; 445 } 427 446 428 447 parse_str( $_POST['group_order'], $order );
Note: See TracChangeset
for help on using the changeset viewer.