Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-7860

Username-search for posts of guest/deleted users

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 3.0.6
    • 3.0.2
    • Search
    • None
    • PHP Environment:
      Database:

      You can't search for guest-posts and posts of deleted users with the username field.
      The problem is, that the username is converted into an user_id
      search.php (104-129 of 3.0.3-RC1)

      	else if ($author)
      	{
      		if ((strpos($author, '*') !== false) && (utf8_strlen(str_replace(array('*', '%'), '', $author)) < $config['min_search_author_chars']))
      		{
      			trigger_error(sprintf($user->lang['TOO_FEW_AUTHOR_CHARS'], $config['min_search_author_chars']));
      		}
       
      		$sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'";
       
      		$sql = 'SELECT user_id
      			FROM ' . USERS_TABLE . "
      			WHERE $sql_where
      				AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
      		$result = $db->sql_query_limit($sql, 100);
       
      		while ($row = $db->sql_fetchrow($result))
      		{
      			$author_id_ary[] = (int) $row['user_id'];
      		}
      		$db->sql_freeresult($result);
       
      		if (!sizeof($author_id_ary))
      		{
      			trigger_error('NO_SEARCH_RESULTS');
      		}
      	}

      but there are no entries for deleted users and guests, where the username is like you are searching for. so i think you should check for guest posts, with the username aswell.

            nickvergessen Joas Schilling
            nickvergessen Joas Schilling
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: