Manual
vB Ad Management - Version 4.00
Skip to: | Features | Changelog | Download | Installation | Setup And Usage | Support | FaqFeatures
vB Ad Management is a free and flexible advertising management system for vBulletin forum software.
Display advertisements forum-wide and beyond. Any advertisement can be displayed at any point on your forum, with
each advertisement independently managed as a separate "adcode block". By default some of the most common locations for advertisements
are included with pre-set options, such as displaying an advertisement after the first post in a thread.
Preset ad formats. In addition to common settings, some common advertisement setups are included by
default. These include forum sponsors, page columns and full-page advertisements.
Advertisement sharing and advertisement revenue sharing. Any part of your advertisement code can be set
aside for ad sharing and ad revenue sharing (not the same thing!) with your forum members and staff.
Easy to use. All settings include additional notes and demonstrations and couldn't be simpler.
You can insert complex content into your forum in seconds and can instantly preview your
advertisement before publishing.
Random advertisement arrays. An adcode block may contain single advertisements or a random rotation
of any number of multiple advertisements.
Quick settings. As well as individual customisation, a variety of settings allow you to set conditions
across all your advertisements, including ad sharing restrictions and exclusion of page type for advertisement service agreement compliance.
Time-limited advertisements. Set your adcode blocks to appear with a set beginning time, ending time or
both.
Fully templated. Each adcode block is displaying using a standard vBulletin template and is fully editable.
vBulletin conditionals and phrases. As well as standard template functions, conditionals and phrases can
also be used within adcode block themselves, allowing you to customise the advertisement according to your forum users
and settings.
Integrates with external modifications.. If you are using vB Advanced CMS,
Photopost Photo Sharing Gallery or any similar modification which extends the functionality
of your forum, you should be able to integrate vB Ad Management advertisements.
Chameleon advertisements. You may optionally blend the appearance of ads with the forum, for instance allowing them to appear as a post.
Works with external advertisement managers. If all the above is not enough or you already use an
external ad manager like OpenAds, you should have no trouble using it in tandem with
vB Ad Management.
Fast and efficient. vB Ad Management is already used by some very sizable forums without issue and now it's even faster.
Free to download and use, and free support. Support is only available via the vBulletin.org to registered
vBulletin users. You must be registered with RedTyger to download archive/pre-release versions or report a bug. This free
software is supported by a copyright link placed in your forum's footer.
Unlimited customisation! The greatest strength of this modification is that there is no limit to what you
can do with it. You do not even have to use it for advertisements, you can use it to manage the display of any
content you want. Let's say you wanted
to display a random set of 5 advertisements to just 2 specific users in 8 different forums with 3 different parts of each
individual advertisement shared with the users in 3 different ways for two weeks of the year, provided the users had a
post count of over 500, were in usergroup 10 and were not using Internet Explorer. You can do that, plus much more, in any combination!
Changelog: Differences between version 4.00 Beta and 4.00
- Added the option to use time spent browsing as method of redirecting to the full page advertisement and removed some of the extreme low numbers for other full page settings.
- Added option to redirect to the full page advertisement when first arriving.
- Added check of valid full page advertisement content before redirecting. This needs explaining. Because it is an intrusive method of advertising that you may not want to force on members who would ordinarily see advertisements, I felt some way of being able to exlude users from full page redirects specifically was needed. Because a separate set of settings would be unwieldy, instead it checks template conditionals within the advertisement. If no full page advertisement content would be shown to that user, the redirect does not take place.
- Added trimming to the createad function, partially to ensure the above check is accurate.
- Added template hooks to the autoinsert instructions, since it was not clear they could be used as well.
- Changed requiring of external files to including.
- Changed checktimescale function to be called checkadtime. More consistent with the other function names and less likely to conflict with other names.
- Fixed archive header advertisements creating invalid XHTML.
- Fixed minor spacing issue in Internet Explorer 6 in the advertisement_fullpage template.
- Fixed postbit advertisements appearing with every post regardless of settings.
- Fixed threadbit advertisements not appearing at all.
- Fixed admin note and demo styling being difficult to read on some AdminCP styles. See BugID 28.
- Fixed error from PHP on some UserCP pages. See BugID 29
- Fixed incorrect column spanning display in Opera in a couple of templates.
- Fixed unreliable redirection to full page advertisements.
- Removed unnecessary eval of custom adcode blocks.
Changed files
- vb_ad_management.xml
- languages/vb_ad_management_english.php
- uploads/admincp/vb_ad_management.php
- uploads/includes/vb_ad_management/global_start.php
- uploads/includes/vb_ad_management/global_complete.php
- uploads/includes/vb_ad_management/functions_vb_ad_management.php
View all vB Ad Management changelogs
Download
vB Ad Management 4.00 is available to all registered RedTyger users from the vB Ad Management 4.00 release announcement or from the vBulletin.org release thread for all vBulletin users with a confirmed license.
At least one major version update has been released since this version, this version may no longer be available for download. You should consider upgrading to the latest version which is likely to contain major benefits over this version.
Requirements: vBulletin forum software 3.5 or later.
Installing/Uninstalling
New installation
- Extract the contents of the download file to your computer.
- Upload vb_ad_management.xml via the Product Manager at AdminCP > Plugins & Products > Manage Products > [Add/Import Product].
- Upload languages/vb_ad_management_english.xml also via the Product Manager if you wish to use the English language version of the product, or use an alternative language file if you have/can find one. You can actually disable the language product after installing, it may save memory to do so but I don't know.
- Upload the contents of the uploads folder to the equivalent location in your forum on your server. The directory structure within the download file is the same as your forum. So admincp/vb_ad_management goes in your forum's admincp directory, etc.
- Reload your AdminCP page so that the new vB Ad Management menu appears.

- In AdminCP > vB Ad Management > Custom is an option to delete unused custom blocks, you should run this once to optimise memory even if you are not using any custom blocks.
- If you are the owner of a brand-free vBulletin license, please read this FAQ entry.
- Done!
Upgrading from a previous version
Version 4.00 Beta and later only:
Overwrite files marked as changed in the changelog and upload changed xml files with overwrite set to Yes.
Version 3.14 and earlier only:
Because of the substantial code and functional changes such as the merging of static and random advertisements, upgrading is unfortunately not possible. Please follow the steps below, then the instructions for a new installation. Be sure to make a note of important settings.
- Uninstall the modification via the Product Manager at AdminCP > Plugins & Products > Manage Products > vB Ad Management (Dropdown menu).
Version 3.10 and later only: - Delete the includes/vb_ad_management folder from your server.
Removing the modification
- Uninstall the modification via the Product Manager at AdminCP > Plugins & Products > Manage Products > vB Ad Management (Dropdown menu).
- Delete all installation files from your server.
Setup and usage
The settings are thoroughly explained with accompanying examples and notes when configuring the modification. They are easy to follow but I would suggest going through the options in the order in which they are presented in the main menu. A couple of specifics are described below.
If you'd like to pay to have it done for you, it'll cost you:
£10 GBP if you would like me to install vB Ad Management for you.
£20 GBP plus for configuring and/or installation. It depends what and how much needs doing.
Create a private discussion with me or contact me for further details.
Creating an advertisement
Each section of code is assigned a "block" both on the forum and in the settings and each block has settings which apply to that block only. Setting up an advertisement block is very easy, an example of an adcode block is shown below. At its most basic, all you have to do is turn the advertisement block on and paste your advertisement code into the large text box. It will then appear on your forum wherever you insert $x_advertisement into your forum template, where x is the name of the block. It's as simple as that! Optionally you can also set a period of time for the ad block to be shown, as well as have your template edit done automatically.
Editing the templates
To edit the templates to insert your advertisement block, visit AdminCP > Styles & Templates > Style Manager > Edit Templates. Open the appropriate template and paste in $x_advertisement, where x is the name of the block. All of the default advertisement blocks are also templated, they are named advertisement_x and can be found within the Advertisement template group. Within the modification, locations are described by their name within vBulletin rather than a description of their location. So the navbar block is applied to the navbar template, and so on. How the names transribe to their location within your forum is described below.
Implementing ad sharing
Advertisement sharing and advertisement revenue sharing is a system whereby the administrator of a website allows members to input their own ad management details, usually according to certain restrictions. Upon certain conditions being fulfilled, the member's ad management details will be temporarily used instead of the admininstrators, so substituting any admin revenue/exposure for that of the member.
In practise there are two ways that this may be done, both possible using vB Ad Management. The first is ad revenue sharing. This is where the ad provider is set by the administrator, allowing only the publisher/owner details to be variable. The other is ad sharing, where an entire advertisement may be variable, such as a link/banner comination which a member can set themselves.
Use of ad sharing is based on user profile fields, which are the user-input sections both custom and default which are found in various sections of a user's UserCP. You can view existing user profile fields and add a wide variety yourself via AdminCP > User Profile Fields > User Profile Field Manager. I'm going to demonstrate how to integrate ad revenue sharing using Google's Adsense. ( ) Here's a typical Adsense code.
<script type="text/javascript"><!--
google_ad_client = "ca-pub-1111";
google_ad_slot = "6799";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
The google_ad_client part is what I'm interested in. The letter/number sequence there is the ID of the publisher to whom the royalties are paid. If I change that ID, I change where the payments for that advertisement go. So, what I want to do is replace that part of the code with someone's publisher ID depending on circumstance. I've created a User Profile Field, which will appear in every ad sharing enabled user's UserCP. I need to make a note of the field number that vBulletin has assigned that field, which can by found by viewing AdminCP > User Profile Fields > User Profile Field Manager. In this case it is field6.
So, in the Adsense code I'm going to replace the section I want to be variable with the appropriate field number, with a # either side of it to indicate that this is the removable section.
<script type="text/javascript"><!--
google_ad_client = "#field6#";
google_ad_slot = "6799";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
That can now be pasted into an adcode block and saved. However, ad sharing may not always be triggered. So I need to set what will appear in field6's place by default when it is not making use of a user's shared adcode. If you go to AdminCP > vB Ad Management > Ad Sharing, at the bottom of the page is a list of all your forum's user fields. Here you should enter the code which should appear when an advertisement is displayed as normal, in this case it should by my publisher ID which I replaced in the original Adsense code.
Now your adcode is ready to be displayed on the forum. If a member of your forum has an Adsense publisher ID, they can enter it into their Profile and if ad sharing is triggered, their publisher ID will be used instead of yours.
So to summarise. Create a user profile field for each adcode section you want saved, replace the appropriate part in the code with #fieldx# where fieldx is the field ID and enter a default value for that section of the adcode. You can use as many shared fields in as many adcodes as you like and there is no restriction to what you can do with them.
Secure ad sharing
As you are allowing users to directly insert content into your forum, you'll want to be very sure that they can only add what you want them to add. There are three ways you can do this.
Firstly, share only what you have to. In the above ad sharing example, I only shared the publisher ID, a small part of the overall advertisement code. What I could have done is made the entire adcode block a shared item and allowed the user to insert their own Adsense code in its entirety, much less securely. If I wanted to share more than just the publisher ID, say allowing the user to specify their own channel as well, I would have replaced that with another custom field. Even if I needed a dozen different parts of the adcode shared, I would have split it into different fields.
Secondly, do not enable the "Allow HTML" shared option unless your users absolutely must be able to use HTML. When HTML is disabled a sizable range of potential abuses are not possible (inserting unwanted images, for example).
Thirdly, make use of the "Regular Expression" field which is provided by vBulletin when creating a custom field. This allows you to very precisely limit what can be used in the user's shared code, right down to individual characters and their number. For instance, for the above example I used the regular expression ^ca-pub-[0-9]{4}$. This allows the letters ca, then a hypen, then the letters pub, then another hyphen, then any of the numbers 0 to 9 exactly four times in a row. Anything else will be denied. Regular expressions can be very complex and are an acquired expertise as well limited in that you must generally know what will be submitted in order to check it, but are extremely secure if they can be used.
Conditionals
You can make use of vBulletin's template conditionals in your adcode. They are reasonably easy to use once you understand how they work. Broadly speaking, they mean "if this condition is true, display this" and generally work by comparing one value with another to establish a condition to evaluate. You are likely to only want to use a handful of conditionals, such as deciding conditions based on forum ID, user ID, usergroup, and possibly some further ones such as THIS_SCRIPT definition and threadid.
To use a conditional, you use two tags with your chosen condition in between the condition="condition goes here" part. What is between the tags will be displayed if the condition is true. Lets say I want to display "Hello" if the current page is within forum ID 2. I would use this in/as my code.
<if condition="in_array($forum, array(2))">Hello</if>That compares the value of the current forum ID (held as $forum in vBulletin's code) with the number 2, which I want it to match. I can add an unlimited number of extra forum IDs by separating them with commas.
<if condition="in_array($forum, array(2,3,4,5))">Hello</if>I can instead say if this condition is NOT true - display "Hello" if the page is not forum ID 2, 3, 4, or 5 - by beginning the condition with !, like this.
<if condition="!in_array($forum, array(2,3,4,5))">Hello</if>So, if I wanted to display "Yes" if the current page being viewed were in forum ID 2 or 3, and "No" if the current page were in neither of those fora, I could do this:
<if condition="in_array($forum, array(2,3))">Hello</if><if condition="!in_array($forum, array(2,3))">Goodbye</if>
That will work fine, but vBulletin also allow you to specify what to do if a conditional is not true, in other words if this condition is true display this, else display this. So the above conditional could be rewritten a little more clearly as this, which does exactly the same thing:
<if condition="in_array($forum, array(2,3))">Hello<else />Goodbye</if>What if you wanted to do something a little more complicated? Lets say I want to display "Hello" if the current page is in forum ID 2 or 3, but "Hello and welcome to my forum" if the current page is in forum ID 2 only? Conditionals can be used inside each other (including inside <else />s), known as nested conditionals, allowing further specifications. The code for what I want to do looks like this:
<if condition="in_array($forum, array(2,3))">Hello
<if condition="in_array($forum, array(2))">
and welcome to my forum
</if>
</if>
Note that each opening <if condition tag must also have a closing </if>tag each. Comparing to the forum ID is not the only condition you can evaluate, you can also make use of other values:
- $bbuserinfo[usergroupid], which is the current user's usergroup.
- Various other subdivisions of $bbuserinfo such as $bbuserinfo[userid], which is the current user's ID.
- $threadinfo[threadid], the current thread ID.
- THIS_SCRIPT, the current definition of THIS_SCRIPT.
There are many many more, but you can evaluate any value of any kind against any other. If a value is not set such as when evaluating $threadinfo[threadid] when outside a thread or when spelling a value incorrectly, it will default to being defined as 0. Lets see some examples.
<if condition="in_array(THIS_SCRIPT, array(register,login))">This is a registration or login page.
</if> <if condition="in_array(THIS_SCRIPT, array(register,login))">
This is a registration or login page.
<else />
<if condition="in_array($bbuserinfo[usergroupid], array(1,3,4))">
This is not a registration or login page and this person is not a fully registered forum member.
</if>
</if>
Finally, there is a more advanced AND/OR syntax which you can use within conditionals. This does exactly what it sounds like. If condition 1 is true AND condition 2 is true, display this. Or, if condition 1 is true OR condition 2 is true, display this. You can use as many as you like in a row and can combine AND and OR in a single condional, but be wary of how the logic pans out.
<if condition="in_array($forumid, array(1)) AND !in_array($bbuserinfo[usergroupid], array(6))">This is forum 1 and you are not an administrator.
<else />
This is not forum 1 or you are an administrator.
</if>
<if condition="in_array($forumid, array(1)) OR in_array($bbuserinfo[usergroupid], array(6)) OR in_array($bbuserinfo[userid], array(1))">
This is forum 1 or you are an administrator or your userid is 1.
<else />
This is not forum 1 or you are not an administrator or your userid is not 1.
</if>
For comparing single values to form a conditional, there are a few simple evaluators which you can use in additional to the is equal/is not equal evaluators above. I'll use numbers for the examples, though of course it usually makes no sense to use static numbers for conditionals.
- == means is equal to. <if condition="1 == 2"> means "if 1 is equal to 2".
- != means is not equal to. <if condition="1 != 2"> means "if 1 is not equal to 2".
- > means is greater than. <if condition="1 > 2"> means "if 1 is greater than 2".
- < means is less than. <if condition="1 < 2"> means "if 1 is less than 2".
If you need further help with conditionals, you should ask on the vBulletin forums or the unofficial alternative at vBulletin.org forums.
Support
Be sure to check the manual and FAQ first, after which help about using the product is available from the release thread on vBulletin.org only. You must register there and confirm your vBulletin license is valid first. I'll do my best to help, but it's on an if-and-when basis since the number of vB Ad Management users rather exceeded what I was expecting. Other users often chime in to help out.
Reporting a bug is where you can report errors with the software.
Frequently Asked Questions
I'm using a brand-free version of vBulletin / Enabling advertisements makes my forum pages go blank!
The full copyright link to my website must be present for the modification to work. If you are using a brand-free version of vBulletin you may find that it is not added automatically and that page display fails when vB Ad Management is turned on. There are two easy ways to fix this. Copy the following text... `
<br />Ad Management by <a href="http://redtyger.co.uk/" title="RedTyger website design, hosting and domains." target="_blank">RedTyger</a>... onto the end of vBulletin's copyright text field at AdminCP > vBulletin Options > vBulletin Options > Site Name / URL / Contact Details (admincp/options.php?do=options&dogroup=address). If that doesn't work, you can paste it directly into the footer template at AdminCP > Styles & Templates > Style Manager > Edit Template (in the style dropdown menu) > footer template. Where it says <!-- Do not remove this copyright notice --> is likely the best place.
Can I purchase a brand-free version?
Sorry, currently you can't. The modification must be used with the branded link visible.
Can I offer my translation for download on my website?
Yes, if you have created a translation file then you can offer it for download, distribute it, sell it, whatever you like. There's a couple of notes included with the language file you should bear in mind when doing the translating. You don't need to ask me for permission to translate, though if you'd like me to include a link to your translation on my website then just let me know and I'll see what I can do. But you may only distribute your own vb_ad_management_(language).xml file. The rest of the product is for download on RedTyger and on vBulletin.org only and cannot be redistributed.
Can you give me a regular expression to restrict shared adcode to one banner link?
^<a href="[\w-:./_]+"( target="_blank")?><img src="[\w-:./_]+"( alt="[\w ]+")?( border="[0-5]")? /></a>$The above regex above will do just that. I'll run through what it means it briefly.
<a href="[\w-:./_]+"( target="_blank")?>This part means a hyper link using at least one the characters 0 to 9, A to Z (including lowercase versions), and the other characters inside the square brackets. No other characters are permitted. They may optionally add target="_blank" to the link code, which means clicking the link will open it in a new window.
<img src="[\w-:./_]+"( alt="[\w ]+")?( border="[0-5]")? />This part means an image with the source using the same character restrictions as for the link, plus optionally some text (A to Z and lower case versions only) to describe the image and an optional image border of 0 to 5 pixels wide.
All the optional items are only permitted at exactly in that place within the code. Further restrictions are possible if you wish.
You can restrict the image source to a location of your choice - so users can only use images you have put on your website and screened already, for example - simply by adding parts to the src (image source) code that users will not be able to work around. src="http://redtyger.co.uk/[\w-:./_]+" means only an image URL beginning with http://redtyger.co.uk will be accepted, or you can use http://(www.)?redtyger.co.uk to allow the URL with or without the www. part.
Perhaps you want to restrict the types of image the user can use for their advertisement. src="http://redtyger.co.uk/[\w-:./_]+(.jpg|.jpeg.|.gif)" means that the image URL must begin with http.redtyger.co.uk and end with .jpg, .jpeg or .gif. Just add more file extensions separated by | to extend the list.
Can I set a timescale for individual parts of an adcode block?
Yes you can, using conditionals. vBulletin has a variable called TIMENOW which is, surprise, the exact time when viewing a page. You can compare this with a time of your own choosing, specified using the Unix timestamp format. To get this number, you can use this Unix timestamp converter. It will provide you with a string of numbers which is actually the number of seconds since 1st January, 1970 (Don't ask). All you have to do is compare the time now with the time of your specification using greater than or less than, like this.
<if condition="TIMENOW > 1199163600">If TIMENOW is greater than 1199163600, this will be displayed.
Which translates as: If the time now is later than 1st January 2008, this will be displayed.
</if>
<if condition="TIMENOW < 1199163600">
If TIMENOW is less than 1199163600, this will be displayed.
Which translates as: If the time now is earlier than 1st January 2008, this will be displayed.
</if>
<if condition="TIMENOW < 1262322000 AND TIMENOW > 1104555600">
If TIMENOW is less than 1199163600 and is greater than 1104555600 this will be displayed.
Which translates as: If the time now is earlier than 1st January 2010 and later than 1st January 2005, this will be displayed.
</if>
Why won't Ad sharing work with my comment stripper?
Comments are required for the modification to be able to separate advertisements from everything else to be sure it only alters the intended content, removing them means it can no longer do that. Comment strippers are almost universally unnecessary and you'd lose little by not having one.
I am getting an error message about function.include
If you are getting warning messages at the top of the page that looks something like this...
Warning: include(vb_ad_management.php) [function.include]: failed to open stream: No such file or directory in home\website on line 1
...it means that the required files have not been uploaded correctly. Please review the instructions and try again.