Skip to content

Commit

Permalink
Have get_current_user_id() return 0 when pluggable.php is not yet inc…
Browse files Browse the repository at this point in the history
…luded (which brings the ability to set or get the current user).

fixes #25690 for trunk.

Built from https://develop.svn.wordpress.org/trunk@25929


git-svn-id: http://core.svn.wordpress.org/trunk@25888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Oct 26, 2013
1 parent d6b436a commit 823ad1a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wp-includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ function count_many_users_posts( $users, $post_type = 'post', $public_only = fal
* @return int The current user's ID
*/
function get_current_user_id() {
if ( ! function_exists( 'wp_get_current_user' ) )
return 0;
$user = wp_get_current_user();
return ( isset( $user->ID ) ? (int) $user->ID : 0 );
}
Expand Down

0 comments on commit 823ad1a

Please sign in to comment.