PDA

View Full Version : News Mod and vb_Cement integration


SteveRobWhateve
06-05-2007, 02:50 AM
There is a new mod over at vBulletin.org that let's you arrange topics. It's called vb_Cement:

http://www.vbulletin.org/forum/showthread.php?t=148940
vB_Cement
This is a mod based on a PHPBB mod.

It allows you to 'weigh' threads, give them precedence over others. If you have a lot of stickies, this is very useful. Through edit thread you can set the weight. This has two simple plugins and one template mod to install.

The way it works is simple. By default, all threads are weighted at 0, anything above that will take precedence over the rest that don't have a higher weight.

I was wondering if there was a way to integrate this with the news module so the same display order in the forums is show in the news module?

SteveRobWhateve
06-05-2007, 08:55 PM
Nobody?

Our Sponsors
 

convergent
06-05-2007, 10:35 PM
You can certainly do it... you'd just need to modify the query in the news.php module to add the fields needed to sort the way you want, and put the logic in to do the sort. I assume that the mod adds a column to the threads table.

SteveRobWhateve
06-06-2007, 02:24 AM
So this is the xml file that came with the mod:

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <product productid="_cement" active="1">
<title>vB_Cement</title>
<description>Thread weigting system for vBulletin</description>
<version>1.0</version>
<url />
<versioncheckurl />
<dependencies />
- <codes>
- <code version="1.0">
- <installcode>
- <![CDATA[
$Query = "ALTER TABLE `".TABLE_PREFIX."thread` ADD `threadweight` INT( 10 ) NOT NULL";
$vbulletin->db->query($Query);

]]>
</installcode>
- <uninstallcode>
- <![CDATA[
$!Query = "ALTER TABLE `".TABLE_PREFIX."thread` DROP `threadweight`";

$vbulletin->db->query($Query);

]]>
</uninstallcode>
</code>
</codes>
<templates />
- <plugins>
- <plugin active="1" executionorder="5">
<title>reorder</title>
<hookname>forumdisplay_query_threadscount</hookname>
- <phpcode>
- <![CDATA[ $sqlsortfield = "`threadweight` DESC, ".$sqlsortfield;
]]>
</phpcode>
</plugin>
- <plugin active="1" executionorder="5">
<title>change_weight</title>
<hookname>threadmanage_update</hookname>
- <phpcode>
- <![CDATA[
$vbulletin->input->clean_array_gpc('p', array(
'weight' => TYPE_INT
));
$vbulletin->db->query("UPDATE `".TABLE_PREFIX."thread` SET `threadweight`=".$vbulletin->GPC['weight']." WHERE `threadid`=$threadinfo[threadid]");

]]>
</phpcode>
</plugin>
</plugins>
<phrases />
<options />
<helptopics />
<cronentries />
<faqentries />
</product>

What part am I adding to news.php and where? I am new to all this, sorry...

Our Sponsors
 

convergent
06-06-2007, 11:47 AM
It looks like you have a new column, threadweight, added to the thread table. You'll have to find the query in news.php and add that column to the SELECT statement, and then also include it into the sort logic. The exact logic will depend on what you are trying to achieve. I would guess that the sorting logic for vBCement is in some .php file that you uploaded as part of the installation.

SteveRobWhateve
06-06-2007, 08:25 PM
No, the modification is one template edit and the xml file I posted below, that's it....and unfortunately I am so new to all this that I don't know what that last post meant...I feel like an idiot....

XML File:
<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="_cement" active="1">
<title>vB_Cement</title>
<description>Thread weigting system for vBulletin</description>
<version>1.0</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
<code version="1.0">
<installcode><![CDATA[$Query = "ALTER TABLE `".TABLE_PREFIX."thread` ADD `threadweight` INT( 10 ) NOT NULL";
$vbulletin->db->query($Query);]]></installcode>
<uninstallcode><![CDATA[$!Query = "ALTER TABLE `".TABLE_PREFIX."thread` DROP `threadweight`";

$vbulletin->db->query($Query);]]></uninstallcode>
</code>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>reorder</title>
<hookname>forumdisplay_query_threadscount</hookname>
<phpcode><![CDATA[$sqlsortfield = "`threadweight` DESC, ".$sqlsortfield;]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>change_weight</title>
<hookname>threadmanage_update</hookname>
<phpcode><![CDATA[$vbulletin->input->clean_array_gpc('p', array(
'weight' => TYPE_INT
));
$vbulletin->db->query("UPDATE `".TABLE_PREFIX."thread` SET `threadweight`=".$vbulletin->GPC['weight']." WHERE `threadid`=$threadinfo[threadid]");]]></phpcode>
</plugin>
</plugins>
<phrases>
</phrases>
<options>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>


Install Instructions:
Product vB_Cement
(c) Chris James 2007
Version 1.0

Installation is fairly simple here, upload the XML file into your products and do a simple template edit.

In the template "threadadmin_editthread", find this:

"<div><label for="cb_visible"><input type="checkbox" name="visible" value="yes" id="cb_visible" $visiblechecked />$vbphrase[thread_is_visible]</label></div>"


Below that add this in:

"<!-- EDIT FOR CEMENT PRODUCT -->
<div><input type="text" name="weight" value="$threadinfo[threadweight]" id="cb_thread_weight" size="1" /> Thread weight: Set the preference for this thread.</div>
<!-- /EDIT FOR CEMENT PRODUCT -->"

If you have any questions, comments or problems with this product, feel free to contact me for assistance.

webmaster@ninercaphell.com