Ticket #10837: 10837-3.diff
File 10837-3.diff, 19.5 KB (added by , 15 years ago) |
---|
-
wp-includes/registration.php
202 202 $user_id = (int) $wpdb->insert_id; 203 203 } 204 204 205 update_user meta( $user_id, 'first_name', $first_name);206 update_user meta( $user_id, 'last_name', $last_name);207 update_user meta( $user_id, 'nickname', $nickname );208 update_user meta( $user_id, 'description', $description );209 update_user meta( $user_id, 'rich_editing', $rich_editing);210 update_user meta( $user_id, 'comment_shortcuts', $comment_shortcuts);211 update_user meta( $user_id, 'admin_color', $admin_color);212 update_user meta( $user_id, 'use_ssl', $use_ssl);205 update_user_meta( $user_id, 'first_name', $first_name); 206 update_user_meta( $user_id, 'last_name', $last_name); 207 update_user_meta( $user_id, 'nickname', $nickname ); 208 update_user_meta( $user_id, 'description', $description ); 209 update_user_meta( $user_id, 'rich_editing', $rich_editing); 210 update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts); 211 update_user_meta( $user_id, 'admin_color', $admin_color); 212 update_user_meta( $user_id, 'use_ssl', $use_ssl); 213 213 214 214 foreach ( _wp_get_user_contactmethods() as $method => $name ) { 215 215 if ( empty($$method) ) 216 216 $$method = ''; 217 217 218 update_user meta( $user_id, $method, $$method );218 update_user_meta( $user_id, $method, $$method ); 219 219 } 220 220 221 221 if ( isset($role) ) { -
wp-includes/user.php
267 267 global $wpdb; 268 268 if ( !$global ) 269 269 $option_name = $wpdb->prefix . $option_name; 270 return update_user meta( $user_id, $option_name, $newvalue );270 return update_user_meta( $user_id, $option_name, $newvalue ); 271 271 } 272 272 273 273 /** -
wp-includes/capabilities.php
567 567 */ 568 568 function add_role( $role ) { 569 569 $this->caps[$role] = true; 570 update_user meta( $this->ID, $this->cap_key, $this->caps );570 update_user_meta( $this->ID, $this->cap_key, $this->caps ); 571 571 $this->get_role_caps(); 572 572 $this->update_user_level_from_caps(); 573 573 } … … 584 584 if ( empty( $this->roles[$role] ) || ( count( $this->roles ) <= 1 ) ) 585 585 return; 586 586 unset( $this->caps[$role] ); 587 update_user meta( $this->ID, $this->cap_key, $this->caps );587 update_user_meta( $this->ID, $this->cap_key, $this->caps ); 588 588 $this->get_role_caps(); 589 589 } 590 590 … … 609 609 } else { 610 610 $this->roles = false; 611 611 } 612 update_user meta( $this->ID, $this->cap_key, $this->caps );612 update_user_meta( $this->ID, $this->cap_key, $this->caps ); 613 613 $this->get_role_caps(); 614 614 $this->update_user_level_from_caps(); 615 615 do_action( 'set_user_role', $this->ID, $role ); … … 656 656 function update_user_level_from_caps() { 657 657 global $wpdb; 658 658 $this->user_level = array_reduce( array_keys( $this->allcaps ), array( &$this, 'level_reduction' ), 0 ); 659 update_user meta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level );659 update_user_meta( $this->ID, $wpdb->prefix . 'user_level', $this->user_level ); 660 660 } 661 661 662 662 /** … … 670 670 */ 671 671 function add_cap( $cap, $grant = true ) { 672 672 $this->caps[$cap] = $grant; 673 update_user meta( $this->ID, $this->cap_key, $this->caps );673 update_user_meta( $this->ID, $this->cap_key, $this->caps ); 674 674 } 675 675 676 676 /** … … 685 685 if ( empty( $this->caps[$cap] ) ) 686 686 return; 687 687 unset( $this->caps[$cap] ); 688 update_user meta( $this->ID, $this->cap_key, $this->caps );688 update_user_meta( $this->ID, $this->cap_key, $this->caps ); 689 689 } 690 690 691 691 /** … … 697 697 function remove_all_caps() { 698 698 global $wpdb; 699 699 $this->caps = array(); 700 update_user meta( $this->ID, $this->cap_key, '' );701 update_user meta( $this->ID, $wpdb->prefix . 'user_level', '' );700 update_user_meta( $this->ID, $this->cap_key, '' ); 701 update_user_meta( $this->ID, $wpdb->prefix . 'user_level', '' ); 702 702 $this->get_role_caps(); 703 703 } 704 704 -
wp-includes/ms-functions.php
77 77 if ( empty( $blogs ) ) { 78 78 $details = get_dashboard_blog(); 79 79 add_user_to_blog( $details->blog_id, $user_id, 'subscriber' ); 80 update_user meta( $user_id, 'primary_blog', $details->blog_id );80 update_user_meta( $user_id, 'primary_blog', $details->blog_id ); 81 81 wp_cache_delete( $user_id, 'users' ); 82 82 return $details; 83 83 } 84 84 85 $primary_blog = get_user meta( $user_id, "primary_blog" );85 $primary_blog = get_user_meta( $user_id, "primary_blog" ); 86 86 $details = get_dashboard_blog(); 87 87 if ( $primary_blog ) { 88 88 $blogs = get_blogs_of_user( $user_id ); 89 89 if ( isset( $blogs[ $primary_blog ] ) == false ) { 90 90 add_user_to_blog( $details->blog_id, $user_id, 'subscriber' ); 91 update_user meta( $user_id, 'primary_blog', $details->blog_id );91 update_user_meta( $user_id, 'primary_blog', $details->blog_id ); 92 92 wp_cache_delete( $user_id, 'users' ); 93 93 } else { 94 94 $details = get_blog_details( $primary_blog ); 95 95 } 96 96 } else { 97 97 add_user_to_blog( $details->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog 98 update_user meta( $user_id, 'primary_blog', $details->blog_id );98 update_user_meta( $user_id, 'primary_blog', $details->blog_id ); 99 99 } 100 100 101 101 if ( ( is_object( $details ) == false ) || ( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) ) { … … 109 109 if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) { 110 110 $ret = $blog; 111 111 $changed = false; 112 if ( get_user meta( $user_id , 'primary_blog' ) != $blog_id ) {113 update_user meta( $user_id, 'primary_blog', $blog_id );112 if ( get_user_meta( $user_id , 'primary_blog' ) != $blog_id ) { 113 update_user_meta( $user_id, 'primary_blog', $blog_id ); 114 114 $changed = true; 115 115 } 116 if ( !get_user meta($user_id , 'source_domain') ) {117 update_user meta( $user_id, 'source_domain', $blog->domain );116 if ( !get_user_meta($user_id , 'source_domain') ) { 117 update_user_meta( $user_id, 'source_domain', $blog->domain ); 118 118 $changed = true; 119 119 } 120 120 if ( $changed ) … … 126 126 // Should never get here 127 127 $dashboard_blog = get_dashboard_blog(); 128 128 add_user_to_blog( $dashboard_blog->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog 129 update_user meta( $user_id, 'primary_blog', $dashboard_blog->blog_id );129 update_user_meta( $user_id, 'primary_blog', $dashboard_blog->blog_id ); 130 130 return $dashboard_blog; 131 131 } 132 132 return $ret; … … 248 248 if ( empty($user) ) 249 249 return new WP_Error('user_does_not_exist', __('That user does not exist.')); 250 250 251 if ( !get_user meta($user_id, 'primary_blog') ) {252 update_user meta($user_id, 'primary_blog', $blog_id);251 if ( !get_user_meta($user_id, 'primary_blog') ) { 252 update_user_meta($user_id, 'primary_blog', $blog_id); 253 253 $details = get_blog_details($blog_id); 254 update_user meta($user_id, 'source_domain', $details->domain);254 update_user_meta($user_id, 'source_domain', $details->domain); 255 255 } 256 256 257 257 $user->set_role($role); … … 270 270 271 271 // If being removed from the primary blog, set a new primary if the user is assigned 272 272 // to multiple blogs. 273 $primary_blog = get_user meta($user_id, 'primary_blog');273 $primary_blog = get_user_meta($user_id, 'primary_blog'); 274 274 if ( $primary_blog == $blog_id ) { 275 275 $new_id = ''; 276 276 $new_domain = ''; … … 283 283 break; 284 284 } 285 285 286 update_user meta($user_id, 'primary_blog', $new_id);287 update_user meta($user_id, 'source_domain', $new_domain);286 update_user_meta($user_id, 'primary_blog', $new_id); 287 update_user_meta($user_id, 'source_domain', $new_domain); 288 288 } 289 289 290 290 // wp_revoke_user($user_id); … … 293 293 294 294 $blogs = get_blogs_of_user($user_id); 295 295 if ( count($blogs) == 0 ) { 296 update_user meta($user_id, 'primary_blog', '');297 update_user meta($user_id, 'source_domain', '');296 update_user_meta($user_id, 'primary_blog', ''); 297 update_user_meta($user_id, 'source_domain', ''); 298 298 } 299 299 300 300 if ( $reassign != '' ) { … … 826 826 add_option( 'WPLANG', get_site_option( 'WPLANG' ) ); 827 827 update_option( 'blog_public', $meta['public'] ); 828 828 829 if ( !is_super_admin() && get_user meta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )830 update_user meta( $user_id, 'primary_blog', $blog_id );829 if ( !is_super_admin() && get_user_meta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) ) 830 update_user_meta( $user_id, 'primary_blog', $blog_id ); 831 831 832 832 restore_current_blog(); 833 833 do_action( 'wpmu_new_blog', $blog_id, $user_id ); … … 1306 1306 $role = $meta[ 'new_role' ]; 1307 1307 remove_user_from_blog($user_id, $current_site->blogid); // remove user from main blog. 1308 1308 add_user_to_blog( $blog_id, $user_id, $role ); 1309 update_user meta( $user_id, 'primary_blog', $blog_id );1309 update_user_meta( $user_id, 'primary_blog', $blog_id ); 1310 1310 } 1311 1311 } 1312 1312 -
wp-admin/ms-edit.php
96 96 foreach ( (array)$move_users as $user_id ) { 97 97 remove_user_from_blog($user_id, get_site_option( 'dashboard_blog' ) ); 98 98 add_user_to_blog( $dashboard_blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) ); 99 update_user meta( $user_id, 'primary_blog', $dashboard_blog_id );99 update_user_meta( $user_id, 'primary_blog', $dashboard_blog_id ); 100 100 } 101 101 } 102 102 } -
wp-admin/admin-ajax.php
998 998 die('-1'); 999 999 1000 1000 if ( is_array($closed) ) 1001 update_user meta($user->ID, 'closedpostboxes_'.$page, $closed);1001 update_user_meta($user->ID, 'closedpostboxes_'.$page, $closed); 1002 1002 1003 1003 if ( is_array($hidden) ) { 1004 1004 $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv') ); // postboxes that are always shown 1005 update_user meta($user->ID, 'meta-box-hidden_'.$page, $hidden);1005 update_user_meta($user->ID, 'meta-box-hidden_'.$page, $hidden); 1006 1006 } 1007 1007 1008 1008 die('1'); … … 1020 1020 die('-1'); 1021 1021 1022 1022 if ( is_array($hidden) ) 1023 update_user meta($user->ID, "manage-$page-columns-hidden", $hidden);1023 update_user_meta($user->ID, "manage-$page-columns-hidden", $hidden); 1024 1024 1025 1025 die('1'); 1026 1026 break; … … 1040 1040 update_user_option($user->ID, "meta-box-order_$page", $order); 1041 1041 1042 1042 if ( $page_columns ) 1043 update_user meta($user->ID, "screen_layout_$page", $page_columns);1043 update_user_meta($user->ID, "screen_layout_$page", $page_columns); 1044 1044 1045 1045 die('1'); 1046 1046 break; -
wp-admin/includes/upgrade.php
674 674 $users = $wpdb->get_results("SELECT * FROM $wpdb->users"); 675 675 foreach ( $users as $user ) : 676 676 if ( !empty( $user->user_firstname ) ) 677 update_user meta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) );677 update_user_meta( $user->ID, 'first_name', $wpdb->escape($user->user_firstname) ); 678 678 if ( !empty( $user->user_lastname ) ) 679 update_user meta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) );679 update_user_meta( $user->ID, 'last_name', $wpdb->escape($user->user_lastname) ); 680 680 if ( !empty( $user->user_nickname ) ) 681 update_user meta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );681 update_user_meta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) ); 682 682 if ( !empty( $user->user_level ) ) 683 update_user meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );683 update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level ); 684 684 if ( !empty( $user->user_icq ) ) 685 update_user meta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );685 update_user_meta( $user->ID, 'icq', $wpdb->escape($user->user_icq) ); 686 686 if ( !empty( $user->user_aim ) ) 687 update_user meta( $user->ID, 'aim', $wpdb->escape($user->user_aim) );687 update_user_meta( $user->ID, 'aim', $wpdb->escape($user->user_aim) ); 688 688 if ( !empty( $user->user_msn ) ) 689 update_user meta( $user->ID, 'msn', $wpdb->escape($user->user_msn) );689 update_user_meta( $user->ID, 'msn', $wpdb->escape($user->user_msn) ); 690 690 if ( !empty( $user->user_yim ) ) 691 update_user meta( $user->ID, 'yim', $wpdb->escape($user->user_icq) );691 update_user_meta( $user->ID, 'yim', $wpdb->escape($user->user_icq) ); 692 692 if ( !empty( $user->user_description ) ) 693 update_user meta( $user->ID, 'description', $wpdb->escape($user->user_description) );693 update_user_meta( $user->ID, 'description', $wpdb->escape($user->user_description) ); 694 694 695 695 if ( isset( $user->user_idmode ) ): 696 696 $idmode = $user->user_idmode; … … 705 705 endif; 706 706 707 707 // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set. 708 $caps = get_user meta( $user->ID, $wpdb->prefix . 'capabilities');708 $caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities'); 709 709 if ( empty($caps) || defined('RESET_CAPS') ) { 710 $level = get_user meta($user->ID, $wpdb->prefix . 'user_level');710 $level = get_user_meta($user->ID, $wpdb->prefix . 'user_level'); 711 711 $role = translate_level_to_role($level); 712 update_user meta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );712 update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) ); 713 713 } 714 714 715 715 endforeach; -
wp-admin/includes/misc.php
424 424 break; 425 425 } 426 426 427 update_user meta($user->ID, $option, $value);427 update_user_meta($user->ID, $option, $value); 428 428 wp_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); 429 429 exit; 430 430 } -
wp-admin/includes/schema.php
724 724 if ( !is_multisite() ) { 725 725 $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'domain' => $domain, 'path' => $path ) ); 726 726 $blog_id = $wpdb->insert_id; 727 update_user meta( $site_user->ID, 'source_domain', $domain );728 update_user meta( $site_user->ID, 'primary_blog', $blog_id );727 update_user_meta( $site_user->ID, 'source_domain', $domain ); 728 update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); 729 729 } 730 730 731 731 if ( $vhost == 'yes' ) -
wp-admin/includes/ms.php
543 543 544 544 if ( !empty( $blogs ) ) { 545 545 foreach( $blogs as $blogid => $blog ) { 546 if ( $blogid != $dashboard_blog->blog_id && get_user meta( $current_user->ID , 'primary_blog' ) == $dashboard_blog->blog_id ) {547 update_user meta( $current_user->ID, 'primary_blog', $blogid );546 if ( $blogid != $dashboard_blog->blog_id && get_user_meta( $current_user->ID , 'primary_blog' ) == $dashboard_blog->blog_id ) { 547 update_user_meta( $current_user->ID, 'primary_blog', $blogid ); 548 548 continue; 549 549 } 550 550 } 551 $blog = get_blog_details( get_user meta( $current_user->ID , 'primary_blog' ) );551 $blog = get_blog_details( get_user_meta( $current_user->ID , 'primary_blog' ) ); 552 552 $protocol = ( is_ssl() ? 'https://' : 'http://' ); 553 553 wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case" 554 554 exit; … … 690 690 <td> 691 691 <?php 692 692 $all_blogs = get_blogs_of_user( $current_user->ID ); 693 $primary_blog = get_user meta($current_user->ID, 'primary_blog');693 $primary_blog = get_user_meta($current_user->ID, 'primary_blog'); 694 694 if ( count( $all_blogs ) > 1 ) { 695 695 $found = false; 696 696 ?> … … 704 704 <?php 705 705 if ( !$found ) { 706 706 $blog = array_shift( $all_blogs ); 707 update_user meta( $current_user->ID, 'primary_blog', $blog->userblog_id );707 update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id ); 708 708 } 709 709 } elseif ( count( $all_blogs ) == 1 ) { 710 710 $blog = array_shift( $all_blogs ); 711 711 echo $blog->domain; 712 712 if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list. 713 update_user meta( $current_user->ID, 'primary_blog', $blog->userblog_id );713 update_user_meta( $current_user->ID, 'primary_blog', $blog->userblog_id ); 714 714 } else { 715 715 echo "N/A"; 716 716 } -
wp-admin/import/dotclear.php
257 257 else if (2 <= $wp_perms) { $user->set_role('contributor'); } 258 258 else { $user->set_role('subscriber'); } 259 259 260 update_user meta( $ret_id, 'wp_user_level', $wp_perms);261 update_user meta( $ret_id, 'rich_editing', 'false');262 update_user meta( $ret_id, 'first_name', csc ($user_prenom));263 update_user meta( $ret_id, 'last_name', csc ($user_nom));260 update_user_meta( $ret_id, 'wp_user_level', $wp_perms); 261 update_user_meta( $ret_id, 'rich_editing', 'false'); 262 update_user_meta( $ret_id, 'first_name', csc ($user_prenom)); 263 update_user_meta( $ret_id, 'last_name', csc ($user_nom)); 264 264 }// End foreach($users as $user) 265 265 266 266 // Store id translation array for future use -
wp-admin/import/textpattern.php
265 265 if('2' == $transperms[$privs]) { $user->set_role('contributor'); } 266 266 if('0' == $transperms[$privs]) { $user->set_role('subscriber'); } 267 267 268 update_user meta( $ret_id, 'wp_user_level', $transperms[$privs] );269 update_user meta( $ret_id, 'rich_editing', 'false');268 update_user_meta( $ret_id, 'wp_user_level', $transperms[$privs] ); 269 update_user_meta( $ret_id, 'rich_editing', 'false'); 270 270 }// End foreach($users as $user) 271 271 272 272 // Store id translation array for future use -
wp-admin/plugins.php
30 30 if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'network', 'mustuse', 'dropins', 'search')) ) 31 31 $status = 'all'; 32 32 if ( $status != $default_status && 'search' != $status ) 33 update_user meta($current_user->ID, 'plugins_last_view', $status);33 update_user_meta($current_user->ID, 'plugins_last_view', $status); 34 34 35 35 $page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1; 36 36 -
wp-admin/user-edit.php
123 123 if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) ) 124 124 $errors = edit_user($user_id); 125 125 if ( $delete_role ) // stops users being added to current blog when they are edited 126 update_user meta( $user_id, $blog_prefix . 'capabilities' , '' );126 update_user_meta( $user_id, $blog_prefix . 'capabilities' , '' ); 127 127 } 128 128 129 129 if ( !is_wp_error( $errors ) ) {