Ticket #21120: 21120.6.diff
File 21120.6.diff, 2.6 KB (added by , 12 years ago) |
---|
-
wp-includes/capabilities.php
1017 1017 } 1018 1018 1019 1019 if ( '' != $post->post_author ) { 1020 $post_author_data = get_userdata( $post->post_author ); 1020 if ( get_current_user_id() == $post->post_author ) 1021 $post_author_data = wp_get_current_user(); 1022 else 1023 $post_author_data = get_userdata( $post->post_author ); 1021 1024 } else { 1022 1025 // No author set yet, so default to current user for cap checks. 1023 $post_author_data = get_userdata( $user_id ); 1026 if ( get_current_user_id() == $user_id ) 1027 $post_author_data = wp_get_current_user(); 1028 else 1029 $post_author_data = get_userdata( $user_id ); 1024 1030 } 1025 1031 1026 1032 // If the user is the author... … … 1066 1072 } 1067 1073 1068 1074 if ( '' != $post->post_author ) { 1069 $post_author_data = get_userdata( $post->post_author ); 1075 if ( get_current_user_id() == $post->post_author ) 1076 $post_author_data = wp_get_current_user(); 1077 else 1078 $post_author_data = get_userdata( $post->post_author ); 1070 1079 } else { 1071 1080 // No author set yet, so default to current user for cap checks. 1072 $post_author_data = get_userdata( $user_id ); 1081 if ( get_current_user_id() == $user_id ) 1082 $post_author_data = wp_get_current_user(); 1083 else 1084 $post_author_data = get_userdata( $user_id ); 1073 1085 } 1074 1086 1075 1087 //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />"; … … 1120 1132 } 1121 1133 1122 1134 if ( '' != $post->post_author ) { 1123 $post_author_data = get_userdata( $post->post_author ); 1135 if ( get_current_user_id() == $post->post_author ) 1136 $post_author_data = wp_get_current_user(); 1137 else 1138 $post_author_data = get_userdata( $post->post_author ); 1124 1139 } else { 1125 1140 // No author set yet, so default to current user for cap checks. 1126 $post_author_data = get_userdata( $user_id ); 1141 if ( get_current_user_id() == $user_id ) 1142 $post_author_data = wp_get_current_user(); 1143 else 1144 $post_author_data = get_userdata( $user_id ); 1127 1145 } 1128 1146 1129 1147 if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) … … 1423 1441 * @return bool True if the user is a site admin. 1424 1442 */ 1425 1443 function is_super_admin( $user_id = false ) { 1426 if ( ! $user_id ) 1427 $user_id = get_current_user_id(); 1444 if ( ! $user_id || get_current_user_id() == $user_id ) 1445 $user = wp_get_current_user(); 1446 else 1447 $user = get_userdata( $user_id ); 1428 1448 1429 if ( ! $user = get_userdata( $user_id ))1449 if ( ! $user ) 1430 1450 return false; 1431 1451 1432 1452 if ( is_multisite() ) {