get_currentuserinfo [ WordPress Function ]
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Populate global variables with information about the currently logged in user.
Will set the current user, if the current user is not set. The current user will be set to the logged in person. If no user is logged in, then it will set the current user to 0, which is invalid and won't have any permissions.
Source
<?php
function get_currentuserinfo() {
global $current_user;
if ( ! empty( $current_user ) ) {
if ( $current_user instanceof WP_User )
return;
// Upgrade stdClass to WP_User
if ( is_object( $current_user ) && isset( $current_user->ID ) ) {
$cur_id = $current_user->ID;
$current_user = null;
wp_set_current_user( $cur_id );
return;
}
// $current_user has a junk value. Force to WP_User with ID 0.
$current_user = null;
wp_set_current_user( 0 );
return false;
}
if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
wp_set_current_user( 0 );
return false;
}
if ( ! $user = wp_validate_auth_cookie() ) {
if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) || !$user = wp_validate_auth_cookie( $_COOKIE[LOGGED_IN_COOKIE], 'logged_in' ) ) {
wp_set_current_user( 0 );
return false;
}
}
wp_set_current_user( $user );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/get currentuserinfo « WordPress Codex
Description. Retrieves the information pertaining to the currently logged in user, and places it in the global variable $current_user. Properties map directly to the ...
codex.wordpress.org - Function Reference/wp get current user « WordPress Codex
Description. Retrieve the current user object (WP_User). Wrapper of get_currentuserinfo() using the global variable $current_user.
codex.wordpress.org - WordPress Call To Undefined Function get_currentuserinfo() PHP ...
Oct 28, 2009 ... After uploading, installing and activation some plugins for WordPress blog publishing system, the plug-ins may cause the following PHP error ...
www.mydigitallife.info - Call To Undefined Function get_currentuserinfo() | Marco Luthe ...
Jan 28, 2009 ... I just recently updated my WordPress plugins, and after I downloaded Maintenance Mode (v4.0) and uploaded it onto my WordPress blog, ...
www.saphod.net
Gebruikersdiscussies [ wordpress.org ]
- clanderf on "Need to display URL of Current User's Website (from their Profile)"
- clanderf on "Need to display URL of Current User's Website (from their Profile)"
- clanderf on "Need to display URL of Current User's Website (from their Profile)"
- clanderf on "Need to display URL of Current User's Website (from their Profile)"
- clanderf on "Need to display URL of Current User's Website (from their Profile)"
- keesiemeijer on "Need to display URL of Current User's Website (from their Profile)"
- clanderf on "Need to display URL of Current User's Website (from their Profile)"
- keesiemeijer on "Need to display URL of Current User's Website (from their Profile)"
- clanderf on "Need to display URL of Current User's Website (from their Profile)"
- keesiemeijer on "Need to display URL of Current User's Website (from their Profile)"