Автор: Fill747
Дата сообщения: 20.02.2006 12:36
ManHunter
First post on every page of thread
[more]
Go to Plugin System>>Manage Products>>[Add/Import Product]
upload the xml file.
..............................................
Template (sorry this is best way I can offer)
create a new template called 'postbit_first' and copy all your info from 'postbit' to it and save.
if someone wants to make a nicer one and share it please do.
Settings are in forum manager, if you wish to show the first post of the thread on all pages just select yes.
Done
Собственно - сам файл product-firstpostonall.xml
------8<---------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="firstpostonall" title="First Post On All Pages 1.0.0" description="This will allow you to show the first post on every page of a thread." version="1.0.0" active="1">
<codes>
<code version="1.0.0">
<installcode><![CDATA[$vbulletin->db->query_write("ALTER TABLE `". TABLE_PREFIX ."forum` ADD `showfirstpost` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL");]]></installcode>
<uninstallcode><![CDATA[$vbulletin->db->query_write("ALTER TABLE `". TABLE_PREFIX ."forum` DROP `showfirstpost`");]]></uninstallcode>
</code>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1">
<title>Show First Post</title>
<hookname>forumadmin_edit_form</hookname>
<phpcode><![CDATA[print_table_header('Show First Post On Every Page');
print_yes_no_row('Show first post on every thread page?', 'forum[showfirstpost]', $forum['showfirstpost']);]]></phpcode>
</plugin>
<plugin active="1">
<title>First Post On All Pages</title>
<hookname>forumdata_start</hookname>
<phpcode><![CDATA[$this->validfields['showfirstpost'] = array(TYPE_STR, REQ_NO);]]></phpcode>
</plugin>
<plugin active="1">
<title>Show First Post</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[if ($this->forum['showfirstpost']==1 AND $post['postid']==$this->thread['firstpostid']){
$this->templatename = 'postbit_first';
}]]></phpcode>
</plugin>
<plugin active="1">
<title>First Post On All Pages</title>
<hookname>showthread_post_start</hookname>
<phpcode><![CDATA[if ($forum['showfirstpost'] AND $threadedmode == 0 AND $thread['attach'])
{
// Backup
$thread['hasattach'] = $thread['attach'];
unset($thread['attach']);
}]]></phpcode>
</plugin>
<plugin active="1">
<title>First Post On All Pages</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[if (THIS_SCRIPT == "showthread")
{global $globaltemplates;
$globaltemplates = array_merge($globaltemplates, array('postbit_first'));}]]></phpcode>
</plugin>
<plugin active="1">
<title>First Post On All Pages</title>
<hookname>showthread_query</hookname>
<phpcode><![CDATA[if ($forum['showfirstpost'])
{
$ids .= ",$thread[firstpostid]";
$postids = "post.postid IN (0" . $ids . ")";
if ($thread['hasattach'])
{
$attachments = $db->query_read("
SELECT dateline, thumbnail_dateline, filename, filesize, visible, attachmentid, counter,
postid, IF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail, thumbnail_filesize,
attachmenttype.thumbnail AS build_thumbnail, attachmenttype.newwindow
FROM " . TABLE_PREFIX . "attachment
LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype USING (extension)
WHERE postid IN (-1" . $ids . ")
ORDER BY attachmentid
");
$postattach = array();
while ($attachment = $db->fetch_array($attachments))
{
if (!$attachment['build_thumbnail'])
{
$attachment['hasthumbnail'] = false;
}
$postattach["$attachment[postid]"]["$attachment[attachmentid]"] = $attachment;
}
// Restore
$thread['attach'] = $thread['hasattach'];
unset($thread['hasattach']);
}
}]]></phpcode>
</plugin>
<plugin active="1">
<title>First Post On All Pages</title>
<hookname>showthread_postbit_create</hookname>
<phpcode><![CDATA[if ($forum['showfirstpost'] AND $vbulletin->GPC['pagenumber'] > 1)
{
if ($post['postid'] == $thread['firstpostid'])
{
$counter--;
$post['postcount'] = '';
}
else
{
$post['postcount']--;
}
}]]></phpcode>
</plugin>
</plugins>
<phrases>
</phrases>
<options>
</options>
</product>
------8<---------------------
[/more]