[wp-trac] [WordPress Trac] #25481: If you search, it doesn't find anything when you are logged in.

WordPress Trac noreply at wordpress.org
Thu Oct 3 16:13:47 UTC 2013


#25481: If you search, it doesn't find anything when you are logged in.
--------------------------+-----------------------------
 Reporter:  websupporter  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Hi,
 I'm new here and hope I'll do everything allright. Well, I am just testing
 the new 3.7 beta and was curios about the new filter for stopwords.

 Anyway, I installed 3.7 and logged in as an admin. First I was searching
 for 'Hello world' - and there was no result. I was digging a bit in the
 query.php and echoed the $this->request in line 2914:


 {{{
 SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND
 (((wp_posts.post_title LIKE '%hello%') OR (wp_posts.post_content LIKE
 '%hello%')) AND ((wp_posts.post_title LIKE '%world%') OR
 (wp_posts.post_content LIKE '%world%')))  AND wp_posts.post_type IN
 ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish' OR
 wp_posts.post_author =  AND wp_posts.post_status = 'private')  ORDER BY
 (CASE WHEN wp_posts.post_title LIKE '%hello world%' THEN 1 WHEN
 wp_posts.post_title LIKE '%hello%' AND wp_posts.post_title LIKE '%world%'
 THEN 2 WHEN wp_posts.post_title LIKE '%hello%' OR wp_posts.post_title LIKE
 '%world%' THEN 3 WHEN wp_posts.post_content LIKE '%hello world%' THEN 4
 ELSE 5 END), wp_posts.post_date DESC LIMIT 0, 10
 }}}


 You see this statement:

 {{{
 (wp_posts.post_status = 'publish' OR wp_posts.post_author =  AND
 wp_posts.post_status = 'private')
 }}}


 So I went on and came to the line 2762 in which the statement gets altert
 when the user is logged in. There I echoed the $user_id and found out, for
 some reason this ID is empty, so the above statement is created.

 I found out, that the $user_id is defined in 2716, but thats another part
 of an if-else-loop and so no longer active in line 2762. When I defined it
 in the right part of the if-else-loop again:


 {{{
 $user_id = get_current_user_id();
 }}}


 it worked fine.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25481>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list