mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Sped up searching for posts from a specific user a lot
git-svn-id: file:///svn/phpbb/trunk@1586 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
3d46cdb814
commit
04916f4377
1 changed files with 26 additions and 5 deletions
|
@ -287,12 +287,33 @@ else if( $query_keywords != "" || $query_author != "" || $search_id )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$query_author = str_replace("*", "%", trim($query_author));
|
$query_author = str_replace("*", "%", trim($query_author));
|
||||||
|
|
||||||
|
$sql = "SELECT user_id
|
||||||
|
FROM ".USERS_TABLE."
|
||||||
|
WHERE username LIKE '$query_author'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if( !$result )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Couldn't obtain list of matching users (searching for: $query_author)", "", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
if( $db->sql_numrows($result) == 0 )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_MESSAGE, $lang['No_search_match']);
|
||||||
|
}
|
||||||
|
|
||||||
|
while( $row = $db->sql_fetchrow($result) )
|
||||||
|
{
|
||||||
|
if( $matching_userids != "" )
|
||||||
|
{
|
||||||
|
$matching_userids .= ", ";
|
||||||
|
}
|
||||||
|
$matching_userids .= $row['user_id'];
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT p.post_id
|
$sql = "SELECT post_id
|
||||||
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
|
FROM " . POSTS_TABLE . "
|
||||||
WHERE u.username LIKE '$query_author'
|
WHERE poster_id IN ($matching_userids)
|
||||||
AND p.poster_id = u.user_id
|
ORDER BY post_time DESC";
|
||||||
ORDER BY p.post_time DESC";
|
|
||||||
}
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if( !$result )
|
if( !$result )
|
||||||
|
|
Loading…
Add table
Reference in a new issue