Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #40042, comment 1


Ignore:
Timestamp:
03/06/2017 12:10:42 PM (9 years ago)
Author:
BackuPs
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #40042, comment 1

    v2 v3  
    2222
    2323
    24 Now i know i can code around this issue. But that is very cumbersome as i first have to get the users record and compare the author_name (which) is the login name to the user login name;
     24Now i know i can code around this issue. But that is very cumbersome as i  have to get the users records and compare the author_name (which) is the login name to the user login name;
    2525
    2626The question is why in the first time the action is called the $query does not have the user id set?
     
    3636                        $authorname=$author_id;
    3737                        $author_id='';
    38                         $users = get_users( array( 'fields' => array( 'ID' ) ) );
    39                         foreach($users as $user_id){
    40                                 $user_info = get_userdata($user_id->ID);
    41                                 if ($authorname==$user_info->user_login) {
    42                                         $author_id=$user_id->ID;
     38                        $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) );
     39                        foreach($users as $user){
     40                                if ($authorname==$user->user_login) {
     41                                        $author_id=$user->ID;
    4342                                        break;
    4443                                }