WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/15/2016 10:15:21 AM (4 years ago)
Author:
swissspidy
Message:

Users: Deprecate the get_currentuserinfo() pluggable function.

It encourages an ugly pattern like global $userdata; get_currentuserinfo(); in plugins/themes. wp_get_current_user() should be used instead, e.g. $current_user = wp_get_current_user();.

Props scribu for initial patch.
Fixes #19615.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable-deprecated.php

    r34348 r36311  
    3333    _deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
    3434    return wp_set_current_user($id, $name);
     35}
     36endif;
     37
     38if ( !function_exists('get_currentuserinfo') ) :
     39/**
     40 * Populate global variables with information about the currently logged in user.
     41 *
     42 * @since 0.71
     43 * @deprecated 4.5.0 Use wp_get_current_user()
     44 * @see wp_get_current_user()
     45 *
     46 * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise.
     47 */
     48function get_currentuserinfo() {
     49    _deprecated_function( __FUNCTION__, '4.5', 'wp_get_current_user()' );
     50
     51    return wp_get_current_user();
    3552}
    3653endif;
Note: See TracChangeset for help on using the changeset viewer.