Changeset 21563
- Timestamp:
- 08/20/2012 09:58:34 PM (13 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/capabilities.php
r21501 r21563 1017 1017 } 1018 1018 1019 if ( '' != $post->post_author ) { 1020 $post_author_data = get_userdata( $post->post_author ); 1021 } else { 1022 // No author set yet, so default to current user for cap checks. 1023 $post_author_data = get_userdata( $user_id ); 1024 } 1019 $post_author_id = $post->post_author; 1020 1021 // If no author set yet, default to current user for cap checks. 1022 if ( ! $post_author_id ) 1023 $post_author_id = $user_id; 1024 1025 $post_author_data = $post_author_id == get_current_user_id() ? wp_get_current_user() : get_userdata( $post_author_id ); 1025 1026 1026 1027 // If the user is the author... … … 1066 1067 } 1067 1068 1068 if ( '' != $post->post_author ) {1069 $post_author_data = get_userdata( $post->post_author ); 1070 } else {1071 // No author set yet, so default to current user for cap checks.1072 $post_author_ data = get_userdata( $user_id );1073 } 1074 1075 //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />"; 1069 $post_author_id = $post->post_author; 1070 1071 // If no author set yet, default to current user for cap checks. 1072 if ( ! $post_author_id ) 1073 $post_author_id = $user_id; 1074 1075 $post_author_data = $post_author_id == get_current_user_id() ? wp_get_current_user() : get_userdata( $post_author_id ); 1076 1076 1077 // If the user is the author... 1077 1078 if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) { … … 1120 1121 } 1121 1122 1122 if ( '' != $post->post_author ) { 1123 $post_author_data = get_userdata( $post->post_author ); 1124 } else { 1125 // No author set yet, so default to current user for cap checks. 1126 $post_author_data = get_userdata( $user_id ); 1127 } 1123 $post_author_id = $post->post_author; 1124 1125 // If no author set yet, default to current user for cap checks. 1126 if ( ! $post_author_id ) 1127 $post_author_id = $user_id; 1128 1129 $post_author_data = $post_author_id == get_current_user_id() ? wp_get_current_user() : get_userdata( $post_author_id ); 1128 1130 1129 1131 if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) … … 1424 1426 */ 1425 1427 function is_super_admin( $user_id = false ) { 1426 if ( ! $user_id ) 1427 $user_id = get_current_user_id(); 1428 1429 if ( ! $user = get_userdata( $user_id ) ) 1428 if ( ! $user_id || $user_id == get_current_user_id() ) 1429 $user = wp_get_current_user(); 1430 else 1431 $user = get_userdata( $user_id ); 1432 1433 if ( ! $user || ! $user->exists() ) 1430 1434 return false; 1431 1435 -
trunk/wp-includes/pluggable.php
r21413 r21563 134 134 */ 135 135 function get_user_by( $field, $value ) { 136 if ( 'id' === $field && (int) $value && get_current_user_id() === (int) $value )137 return wp_get_current_user();138 139 136 $userdata = WP_User::get_data_by( $field, $value ); 140 137
Note: See TracChangeset
for help on using the changeset viewer.