global $vbulletin, $db;$number_of_attachments = 5;$output = '';$last_attachments = $vbulletin->db->query_read_slave(" SELECT attachment.*, user.*, post.postid, post.threadid, thread.title, filedata.filesize FROM " . TABLE_PREFIX . "attachment AS attachment INNER JOIN " . TABLE_PREFIX . "user AS user ON user.userid = attachment.userid INNER JOIN " . TABLE_PREFIX . "post AS post ON post.postid = attachment.contentid INNER JOIN " . TABLE_PREFIX . "thread AS thread ON thread.threadid = post.threadid INNER JOIN " . TABLE_PREFIX . "filedata AS filedata ON filedata.filedataid = attachment.filedataid ORDER BY attachment.dateline DESC LIMIT " . $number_of_attachments);$n = 0;while ($attachment = $db->fetch_array($last_attachments)){ $output .= '<div'; if ($n++) { $output .= ' style="border-top: 1px solid #CCCCCC"'; } $output .= '>Posted By: <div style="display: inline-block">' . attach_user_link($attachment) . '</div><div title="Uploaded: ' . vbdate($vbulletin->options['dateformat'], $attachment['dateline'], 1) . ' at ' . vbdate($vbulletin->options['timeformat'], $attachment['dateline']) . PHP_EOL . 'Views: ' . $attachment['counter'] . PHP_EOL . 'Size: ' . number_format($attachment['filesize']/1024,1) . ' KB">' . $attachment['filename'] . '</div><a title="Go To Post With Attachment" href="showthread.php?' . $attachment['threadid'] . '-' . str_replace(' ', '-', $attachment['title']) . '&p=' . $attachment['contentid'] . '&viewfull=1#post' . $attachment['contentid'] . '">' . $attachment['title'] . '</a></div>';}return $output;function attach_user_link($user_name){ global $vbulletin; $link = 'member.php?do=getinfo&username=' . $user_name['username']; if ($user_name['displaygroupid']) { $groupid = $user_name['displaygroupid']; } else { $groupid = $user_name['usergroupid']; } $open_tag = $vbulletin->usergroupcache[$groupid]['opentag']; $close_tag = $vbulletin->usergroupcache[$groupid]['closetag']; return '<a title="Go To ' . $user_name['username'] . '\'s Profile" href="' . $link . '">' . $open_tag . $user_name['username'] . $close_tag . '</a>';}