bskr84
01-16-2012, 12:55 AM
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="tsk_attth" active="1">
<title>Forumhome Attachment Thumbnails</title>
<description />
<version>1.0</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<stylevardfns>
</stylevardfns>
<stylevars>
</stylevars>
<plugins>
<plugin active="1" executionorder="5">
<title>Attachment Thumbnails at forumhome</title>
<hookname>forumhome_start</hookname>
<phpcode><![CDATA[if ($vbulletin->options[tsk_attth_online]) {
$frfromcat = $vbulletin->db->query_read("SELECT childlist FROM " . TABLE_PREFIX . "forum WHERE forumid IN (" . $vbulletin->options[tsk_attth_cat]. ")");
while ($cat = $vbulletin->db->fetch_array($frfromcat)) {
$catget .= $cat[childlist];
}
$thfromfr = $vbulletin->db->query_read("SELECT threadid FROM " . TABLE_PREFIX . "thread WHERE forumid IN (".$catget.")");
$ths = array();
while ($th = $vbulletin->db->fetch_array($thfromfr)) {
array_push($ths, $th[threadid]);
}
$thget = implode(',', $ths);
$psfromth = $vbulletin->db->query_read("SELECT postid FROM " . TABLE_PREFIX . "post WHERE threadid IN (" . $thget . ")");
$pssid = array();
while ($pss = $vbulletin->db->fetch_array($psfromth)) {
array_push($pssid, $pss[postid]);
}
$ps_final = implode(',', $pssid);
if ($vbulletin->options[tsk_attth_manual]) {
$attid = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid IN (" .$vbulletin->options[tsk_attth_manualvalues].") ORDER BY RAND() LIMIT 0," . $vbulletin->options[tsk_attth_limit]);
} else {
$attid = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE contentid IN (" .$ps_final.") ORDER BY RAND() LIMIT 0," . $vbulletin->options[tsk_attth_limit]);
}
while ($row = $vbulletin->db->fetch_array($attid)) {
$tsk_attth .= '<a href="showpost.php?p=' . $row[contentid] .'"<img src="attachment.php?attachmentid=' . $row[attachmentid] . '&thumb=1" alt="' . $row[filename] . '" > ';
}
vB_Template::preRegister('FORUMHOME', array('tsk_attth' => $tsk_attth));
vB_Template::preRegister('forumhome_forumbit_level 2_post', array('tsk_attth' => $tsk_attth));
}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_tsk_attth_cat_desc" date="1279352331" username="Tsuki" version="1.0"><![CDATA[Pull attachment thumbnails in these categories' ID. <br/>
<b>Do not leave this field blank <br/>or you will get a database error.</b>]]></phrase>
<phrase name="setting_tsk_attth_cat_title" date="1279352331" username="Tsuki" version="1.0"><![CDATA[Category settings]]></phrase>
<phrase name="setting_tsk_attth_limit_desc" date="1279349607" username="Tsuki" version="1.0"><![CDATA[Number of attachment images to display]]></phrase>
<phrase name="setting_tsk_attth_limit_title" date="1279349607" username="Tsuki" version="1.0"><![CDATA[Number of images to display]]></phrase>
<phrase name="setting_tsk_attth_manual_desc" date="1279352618" username="Tsuki" version="1.0"><![CDATA[Turn on/off Attachment Manually displaying.]]></phrase>
<phrase name="setting_tsk_attth_manual_title" date="1279352618" username="Tsuki" version="1.0"><![CDATA[Enable Manual Attachments Displaying?]]></phrase>
<phrase name="setting_tsk_attth_manualvalues_desc" date="1279352569" username="Tsuki" version="1.0"><![CDATA[Input the attachment ID you want to manually showing.</br>
Separate each value by comma (,).]]></phrase>
<phrase name="setting_tsk_attth_manualvalues_title" date="1279352569" username="Tsuki" version="1.0"><![CDATA[Manual Attachment Displaying]]></phrase>
<phrase name="setting_tsk_attth_online_desc" date="1279349185" username="Tsuki" version="1.0"><![CDATA[Turn on/off the product]]></phrase>
<phrase name="setting_tsk_attth_online_title" date="1279349185" username="Tsuki" version="1.0"><![CDATA[Product On/Off Settings]]></phrase>
<phrase name="settinggroup_tsk_attth" date="1279349149" username="Tsuki" version="1.0"><![CDATA[Forumhome Attachment Thumbnails]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="tsk_attth" displayorder="600">
<setting varname="tsk_attth_online" displayorder="10">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="tsk_attth_cat" displayorder="20">
<datatype>free</datatype>
</setting>
<setting varname="tsk_attth_limit" displayorder="30">
<datatype>posint</datatype>
<defaultvalue>3</defaultvalue>
</setting>
<setting varname="tsk_attth_manual" displayorder="40">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>0</defaultvalue>
</setting>
<setting varname="tsk_attth_manualvalues" displayorder="50">
<datatype>free</datatype>
<defaultvalue>1,2,3</defaultvalue>
</setting>
</settinggroup>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>
Installing Instruction
Import the file product-tsk_attth.xml in Admincp.
For location to show in Forumhome, add the {vb:raw tsk_attth} to the location you want to show the thumbnail.
For location to show inside the Forum - Category box, add the {vb:raw tsk_attth} to the template forumhome_forumbit_level2_post
As in the example i've shown you, that's under forum's description:
Find
<vb:if condition="$show['forumdescription']"><p class="forumdescription">{vb:raw forum.description}</p></vb:if>
Add below it
{vb:raw tsk_attth}
/////////////////////////////////////////////////////////////////////////////
now how could i do this:
<a href="showpost.php?p=' . $row[contentid] .'"
how could i change <a href="showpost.php?p='. $row[contentid] .' " to <a href="showpost.php?t='. $row[threadid] .'"
<product productid="tsk_attth" active="1">
<title>Forumhome Attachment Thumbnails</title>
<description />
<version>1.0</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<stylevardfns>
</stylevardfns>
<stylevars>
</stylevars>
<plugins>
<plugin active="1" executionorder="5">
<title>Attachment Thumbnails at forumhome</title>
<hookname>forumhome_start</hookname>
<phpcode><![CDATA[if ($vbulletin->options[tsk_attth_online]) {
$frfromcat = $vbulletin->db->query_read("SELECT childlist FROM " . TABLE_PREFIX . "forum WHERE forumid IN (" . $vbulletin->options[tsk_attth_cat]. ")");
while ($cat = $vbulletin->db->fetch_array($frfromcat)) {
$catget .= $cat[childlist];
}
$thfromfr = $vbulletin->db->query_read("SELECT threadid FROM " . TABLE_PREFIX . "thread WHERE forumid IN (".$catget.")");
$ths = array();
while ($th = $vbulletin->db->fetch_array($thfromfr)) {
array_push($ths, $th[threadid]);
}
$thget = implode(',', $ths);
$psfromth = $vbulletin->db->query_read("SELECT postid FROM " . TABLE_PREFIX . "post WHERE threadid IN (" . $thget . ")");
$pssid = array();
while ($pss = $vbulletin->db->fetch_array($psfromth)) {
array_push($pssid, $pss[postid]);
}
$ps_final = implode(',', $pssid);
if ($vbulletin->options[tsk_attth_manual]) {
$attid = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid IN (" .$vbulletin->options[tsk_attth_manualvalues].") ORDER BY RAND() LIMIT 0," . $vbulletin->options[tsk_attth_limit]);
} else {
$attid = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE contentid IN (" .$ps_final.") ORDER BY RAND() LIMIT 0," . $vbulletin->options[tsk_attth_limit]);
}
while ($row = $vbulletin->db->fetch_array($attid)) {
$tsk_attth .= '<a href="showpost.php?p=' . $row[contentid] .'"<img src="attachment.php?attachmentid=' . $row[attachmentid] . '&thumb=1" alt="' . $row[filename] . '" > ';
}
vB_Template::preRegister('FORUMHOME', array('tsk_attth' => $tsk_attth));
vB_Template::preRegister('forumhome_forumbit_level 2_post', array('tsk_attth' => $tsk_attth));
}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_tsk_attth_cat_desc" date="1279352331" username="Tsuki" version="1.0"><![CDATA[Pull attachment thumbnails in these categories' ID. <br/>
<b>Do not leave this field blank <br/>or you will get a database error.</b>]]></phrase>
<phrase name="setting_tsk_attth_cat_title" date="1279352331" username="Tsuki" version="1.0"><![CDATA[Category settings]]></phrase>
<phrase name="setting_tsk_attth_limit_desc" date="1279349607" username="Tsuki" version="1.0"><![CDATA[Number of attachment images to display]]></phrase>
<phrase name="setting_tsk_attth_limit_title" date="1279349607" username="Tsuki" version="1.0"><![CDATA[Number of images to display]]></phrase>
<phrase name="setting_tsk_attth_manual_desc" date="1279352618" username="Tsuki" version="1.0"><![CDATA[Turn on/off Attachment Manually displaying.]]></phrase>
<phrase name="setting_tsk_attth_manual_title" date="1279352618" username="Tsuki" version="1.0"><![CDATA[Enable Manual Attachments Displaying?]]></phrase>
<phrase name="setting_tsk_attth_manualvalues_desc" date="1279352569" username="Tsuki" version="1.0"><![CDATA[Input the attachment ID you want to manually showing.</br>
Separate each value by comma (,).]]></phrase>
<phrase name="setting_tsk_attth_manualvalues_title" date="1279352569" username="Tsuki" version="1.0"><![CDATA[Manual Attachment Displaying]]></phrase>
<phrase name="setting_tsk_attth_online_desc" date="1279349185" username="Tsuki" version="1.0"><![CDATA[Turn on/off the product]]></phrase>
<phrase name="setting_tsk_attth_online_title" date="1279349185" username="Tsuki" version="1.0"><![CDATA[Product On/Off Settings]]></phrase>
<phrase name="settinggroup_tsk_attth" date="1279349149" username="Tsuki" version="1.0"><![CDATA[Forumhome Attachment Thumbnails]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="tsk_attth" displayorder="600">
<setting varname="tsk_attth_online" displayorder="10">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="tsk_attth_cat" displayorder="20">
<datatype>free</datatype>
</setting>
<setting varname="tsk_attth_limit" displayorder="30">
<datatype>posint</datatype>
<defaultvalue>3</defaultvalue>
</setting>
<setting varname="tsk_attth_manual" displayorder="40">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>0</defaultvalue>
</setting>
<setting varname="tsk_attth_manualvalues" displayorder="50">
<datatype>free</datatype>
<defaultvalue>1,2,3</defaultvalue>
</setting>
</settinggroup>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>
Installing Instruction
Import the file product-tsk_attth.xml in Admincp.
For location to show in Forumhome, add the {vb:raw tsk_attth} to the location you want to show the thumbnail.
For location to show inside the Forum - Category box, add the {vb:raw tsk_attth} to the template forumhome_forumbit_level2_post
As in the example i've shown you, that's under forum's description:
Find
<vb:if condition="$show['forumdescription']"><p class="forumdescription">{vb:raw forum.description}</p></vb:if>
Add below it
{vb:raw tsk_attth}
/////////////////////////////////////////////////////////////////////////////
now how could i do this:
<a href="showpost.php?p=' . $row[contentid] .'"
how could i change <a href="showpost.php?p='. $row[contentid] .' " to <a href="showpost.php?t='. $row[threadid] .'"