WordPress.org

Make WordPress Core

Ticket #19615: 19615.diff

File 19615.diff, 2.9 KB (added by scribu, 3 years ago)
  • wp-includes/pluggable-deprecated.php

    diff --git wp-includes/pluggable-deprecated.php wp-includes/pluggable-deprecated.php
    index 2a202ac..59cab8c 100644
    function set_current_user($id, $name = '') { 
    3636} 
    3737endif; 
    3838 
     39if ( !function_exists('get_currentuserinfo') ) : 
     40/** 
     41 * Populate global variables with information about the currently logged in user. 
     42 * 
     43 * Will set the current user, if the current user is not set. The current user 
     44 * will be set to the logged in person. If no user is logged in, then it will 
     45 * set the current user to 0, which is invalid and won't have any permissions. 
     46 * 
     47 * @since 0.71 
     48 * @uses $current_user Checks if the current user is set 
     49 * @uses wp_validate_auth_cookie() Retrieves current logged in user. 
     50 * 
     51 * @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set 
     52 */ 
     53function get_currentuserinfo() { 
     54        _deprecated_function( __FUNCTION__, '3.4', 'wp_get_current_user()' ); 
     55 
     56        global $current_user; 
     57 
     58        if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 
     59                return false; 
     60 
     61        if ( ! empty($current_user) ) 
     62                return; 
     63 
     64        if ( ! $user = wp_validate_auth_cookie() ) { 
     65                 if ( is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) { 
     66                        wp_set_current_user(0); 
     67                        return false; 
     68                 } 
     69        } 
     70 
     71        wp_set_current_user($user); 
     72} 
     73endif; 
     74 
    3975if ( !function_exists('get_userdatabylogin') ) : 
    4076/** 
    4177 * Retrieve user info by login name. 
  • wp-includes/pluggable.php

    diff --git wp-includes/pluggable.php wp-includes/pluggable.php
    index 7855004..9b67c71 100644
    function wp_get_current_user() { 
    5757} 
    5858endif; 
    5959 
    60 if ( !function_exists('get_currentuserinfo') ) : 
    61 /** 
    62  * Populate global variables with information about the currently logged in user. 
    63  * 
    64  * Will set the current user, if the current user is not set. The current user 
    65  * will be set to the logged in person. If no user is logged in, then it will 
    66  * set the current user to 0, which is invalid and won't have any permissions. 
    67  * 
    68  * @since 0.71 
    69  * @uses $current_user Checks if the current user is set 
    70  * @uses wp_validate_auth_cookie() Retrieves current logged in user. 
    71  * 
    72  * @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set 
    73  */ 
    74 function get_currentuserinfo() { 
    75         global $current_user; 
    76  
    77         if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 
    78                 return false; 
    79  
    80         if ( ! empty($current_user) ) 
    81                 return; 
    82  
    83         if ( ! $user = wp_validate_auth_cookie() ) { 
    84                  if ( is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) { 
    85                         wp_set_current_user(0); 
    86                         return false; 
    87                  } 
    88         } 
    89  
    90         wp_set_current_user($user); 
    91 } 
    92 endif; 
    93  
    9460if ( !function_exists('get_userdata') ) : 
    9561/** 
    9662 * Retrieve user info by user ID.