Changes between Version 3 and Version 4 of Ticket #40042, comment 1
- Timestamp:
- 03/07/2017 07:49:22 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #40042, comment 1
v3 v4 22 22 23 23 24 Now 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; 25 26 The question is why in the first time the action is called the $query does not have the user id set? 24 Now i know i can code around this issue. But the question is why in the first time the action is called the $query does not have the user id set? 27 25 28 26 … … 33 31 $author_id = get_query_var('author'); 34 32 if (empty($author_id)) $author_id=get_query_var('author_name'); 35 if (!is_numeric($author_id) ) {33 if (!is_numeric($author_id) && !empty($author_id)) { 36 34 $authorname=$author_id; 37 35 $author_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; 42 break; 43 } 44 } 36 $user = get_user_by( 'login', $authorname); 37 if (isset($user->ID)) $author_id=$user->ID; 45 38 } 46 39 if (!empty($author_id)) {