Code:
if ($mybb->input['action'] === 'tag' && !empty($mybb->input['tag'])) {
global $theme, $templates, $header, $footer, $headerinclude, $lang;
add_breadcrumb("Tag Search", "search.php?action=tag");
$tag = htmlspecialchars_uni($mybb->get_input('tag'));
$escaped_tag = $db->escape_string($tag);
// Find threads with this tag
$tids = [];
$query = $db->simple_select('threadtags', 'tid', "tag='" . $escaped_tag . "'");
while ($row = $db->fetch_array($query)) {
$tids[] = (int)$row['tid'];
}
if (empty($tids)) {
error("No threads found for tag: <strong>{$tag}</strong>");
}
$threadlist = "";
$thread_query = $db->query("
SELECT t.*, f.name AS forumname
FROM " . TABLE_PREFIX . "threads t
LEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid = t.fid)
WHERE t.tid IN (" . implode(",", $tids) . ") AND t.visible=1
ORDER BY t.lastpost DESC
");
while ($thread = $db->fetch_array($thread_query)) {
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['forumlink'] = get_forum_link($thread['fid']);
$threadlist .= "<li style='margin-bottom: 10px;'>
<a href='{$thread['threadlink']}' style='font-weight: bold;'>{$thread['subject']}</a>
<div style='font-size: 11px; color: #999;'>Forum: <a href='{$thread['forumlink']}'>{$thread['forumname']}</a></div>
</li>";
}
eval("\$searchresults = \"<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Threads tagged with {$tag}</title>
{\$headerinclude}
</head>
<body>
{\$header}
<table width='100%' border='0' align='center' cellpadding='10'>
<tr>
<td class='trow1'>
<h2 style='margin-bottom: 15px;'>Threads tagged with: <span style='color: #3b8beb;'>#{$tag}</span></h2>
<ul style='list-style: none; padding-left: 0;'>{$threadlist}</ul>
</td>
</tr>
</table>
{\$footer}
</body>
</html>\";");
output_page($searchresults);
exit;
}
Inside the Archive you will find :