The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
First off let me be clear, I'm not a programmer so I don't know what I'm talking about, and I'm probably going to break my forum trying to do this.
So today I was trying to figure out how to make a basic plugin to define an array of forumids to generate a value that I could use in a template conditional. After several iterations of trial and error it functions well, suprisingly. However, I thought it would be better if instead of having to edit the array with forumids, I could add a checkbox in the forum settings for "don't show ads" and store that attribute in the database, using that data to generate the array. That way if I add a new forum and check that box, no ads are displayed and I didn't have to touch the plugin. Any advice on how I could accomplish this? Conceptually it doesn't sound like it could be that difficult but as I said, I'm no programmer. |
#2
|
|||
|
|||
![]()
There's an article on doing just that here: www.vbulletin.org/forum/showthread.php?t=93445 It was written for vb3 but I believe it should still work with vb4.
|
#3
|
|||
|
|||
![]()
Thank you! I searched my face off and didn't find that on my own.
![]() --------------- Added [DATE]1359164686[/DATE] at [TIME]1359164686[/TIME] --------------- Well I've made some progress, I've got the option in place and it sets the value in the database, but I'm having trouble getting the conditional to work. Here's what I've done so far, maybe someone can point out what I missed. Code:
# Create new column in forum table called 'hideads' ALTER TABLE `forum` ADD COLUMN `hideads` smallint(3) unsigned NOT NULL DEFAULT '0', Code:
# Create a plugin at hook forumdata_start $this->validfields['hideads'] = array(TYPE_STR, REQ_NO); # Create a plugin at hook forumadmin_edit_form print_yes_no_row($vbphrase['hide_ads'], 'forum[hideads]', $forum['hideads']); Code:
# Add phrase hide_ads Hide ads in this forum? Code:
# Set conditional in template <vb:if condition="$bbuserinfo[userid] == 0 AND $foruminfo['hideads'] == 0"> ad code here </vb:if> I feel like I need to preregister the variable for the ad templates, but I'm not sure how to define it in this instance. Hideads? $hideads? $foruminfo['hideads']? --------------- Added [DATE]1359213886[/DATE] at [TIME]1359213886[/TIME] --------------- I did some more testing and if I use this conditional in FORUMDISPLAY it works as expected... Code:
<vb:if condition="$foruminfo['hideads'] == 0">test</vb:if> ![]() |
#4
|
|||
|
|||
![]()
Thanks to Kevin for this. All that needed to change was the syntax of the conditional.
Code:
<vb:if condition="$GLOBALS['foruminfo']['hideads']"> |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|