WordPress.org

Make WordPress Core

Ticket #13785: non-deprecate-get_current_user_id.13785.diff

File non-deprecate-get_current_user_id.13785.diff, 1.2 KB (added by filosofo, 5 years ago)
  • wp-includes/user.php

     
    211211// 
    212212 
    213213/** 
     214 * Get the current user's ID 
     215 *  
     216 * @since MU 
     217 *  
     218 * @uses wp_get_current_user 
     219 * 
     220 * @return int The current user's ID 
     221 */ 
     222function get_current_user_id() { 
     223        $user = wp_get_current_user(); 
     224        return ( isset( $user->ID ) ? (int) $user->ID : 0 ); 
     225} 
     226 
     227/** 
    214228 * Retrieve user option that can be either per Site or per Network. 
    215229 * 
    216230 * If the user ID is not given, then the current user will be used instead. If 
  • wp-includes/ms-deprecated.php

     
    9898/** 
    9999 * @since MU 
    100100 * @deprecated 3.0.0 
    101  * @deprecated Use $GLOBALS['current_user']->ID 
    102  */ 
    103 function get_current_user_id() { 
    104         _deprecated_function( __FUNCTION__, '3.0', '$GLOBALS[\'current_user\']->ID' ); 
    105         return $GLOBALS['current_user']->ID; 
    106 } 
    107  
    108 /** 
    109  * @since MU 
    110  * @deprecated 3.0.0 
    111101 * @deprecated Use get_user_by() 
    112102 * @see get_user_by() 
    113103 */