vB Ad Management 3.14 (Ad Sharing Edition)

Duuuhhude

New Member
= vB Ad Management 3.1 =

What does it do?

A common template modification request is about how to insert advertisements into your forum. This does that and allows you to control when it will appear and how it will look via the AdminCP. Settings are extensive and you can insert any content you like. You can also choose to enable Adsharing (see 2nd post of the thread for details).



Features

Global on/off
Turn the plugin on and off. (Exciting stuff!)

Displays ads with posts, single posts, announcements or private messages
Display advertisements with any form of user message.

Displays ads in your header, footer and in a left or right column, with forum categories and with threads
As well as adverts only being previously displayed with threads, you can now include advertisements in all these locations via the AdminCP.

Unlimited customisation at every advertisement location
Every ad location is templated and editable and also offers extensive customisation via the AdminCP. You can choose between static ad code (i.e. Adsense) or a random banner rotation at every location and can use individual code for each type at each location. Display settings below apply either globally and where appropriate to each individual location. Each location can be separately enabled or disabled and postbit advertisements (announcements, private messages, posts) can now also be separately enabled or disabled.

Include or exclude display of advertisements:
  • Per Forum
  • Per Usergroup
  • Per Thread
  • Per User
  • Per Announcement or turn announcement ads on/off
  • Private message ads on/off

Exclude only:
  • THIS_SCRIPT - Allows you to exclude pages from displaying ads based on content type, necessary for some TOS. See the setting explanation in the product AdminCP for more details.

Display using any combination of:
  • Display with first post on a page
  • Display with last post on a page
  • Display every X posts
  • Display with Xth post in a thread
  • Minimum thread postcount before ads will be displayed
  • User postcount - after X posts advertisements will not be displayed.

Remove Ads link
Adds a link with ads to information about upgrading an account to remove advertisements. Custom link & link text, can be turned on/off. You can now also specify the "Sponsored Links" text yourself.

Display ads as user
Choose between displaying advertisments as a post (with optional custom avatar) and standard advertisement display.

Automatic postbit switch
The one-phrase template edit is the same no matter what your settings, you can change between any combination of postbit/postbit_legacy and display as user/standard display at any time and the style will automatically adjust itself.

Displays any code
Anything which can be copied and pasted into the text box will be displayed, HTML included of course. This applies to both the static and random banners. There is no limit to how many banners you can rotate, or filetype, nor for that matter does it even have to be a banner. It will randomly rotate any code you input. Note: It really is random, so you may see the same banner twice in a row.

Google Analytics integration
You can enter your Google Analytics code into vB Ad Management settings and it will be automatically inserted into every page. Aside from saving you a template edit, the analytics can this way be independently turned off.

XHTML valid.
Peace of mind...

Does not cause global warming.
Excellent.

Copyright notice
Ok not a feature, but I felt there is now enough substance as a product to add a link in the footer. If you would like to remove this please make a donation, details below. And be sure to let me know by PM!

This product is my work and mine alone. You are not permitted to distribute it outside of vbulletin.org, take credit for it, etc. Use your common sense and don't steal, basically. I have extremely effective legal recourse against thieves and fraud.



Location names

For ease of use, the locations are referred to by their template names. Once you know what they mean it's a lot clearer, here's a rundown for those who don't know.

Postbit - The postbit template is used to display posts, announcements and private messages.
Threadbit - The threadbit is the template for a single row when viewing a list of threads.
Forumbit - The forumbit is the template for a single row when viewing a list of forums/subforums.
Header - The template containing the logo at the top of your forum pages ONLY. The area immediately below that is the navbar template.
Footer - The template that contains everything at the bottom of your forum pages from the time downward.


Instructions
  • Upload the product using the Product Manager.
  • Go to Style Manager > Edit Templates and...
  • Find <!-- post $post[postid] popup menu --> and paste $postbit_advertisement above it in your postbit & postbit_legacy templates.
  • Paste $forumbit_advertisement at the bottom of your forumhome_forumbit_level1_post and forumhome_forumbit_level2_post templates.
  • Paste $threadbit_advertisement at the bottom of your threadbit template.
  • Paste $footer_advertisement at the top of your footer template.
  • Find $spacer_close in your footer template and below it paste $rightcolumn_advertisement.
  • Find &nbsp; in your header template and replace it with $header_advertisement.
  • Find $spacer_open in your header template and below it paste $leftcolumn_advertisement.


Changing the settings
  • The AdminCP options where you can change your settings are located in vBulletin Options after all the rest of the setting categories.
  • If you want to edit the templates for the advertisements yourself, they are located immediately after their postbit counterparts in the Template Manager list with the suffix "_advertisement". Do not alter any value in the template (that's a string of words or letters beginning with a $ sign) or your ads may stop working! I'll only support the unedited product.

    Important! You cannot see your own shared advertisements! This is to avoid accidentally breaking advertiser's TOS by clicking your own ads. Remember this when testing and be sure to test using someone else's adcode!


Donations

If you have a pressing wish to donate money to me (and of course, you do) to say thank you and to possibly encourage more future work then you can do via the link below. Also, you will go to heaven.

http://redtyger.co.uk/donations.php

Don't panic!
The donations link is only hosted on my website so it can be encrypted and not open my email address to spammers.



Screenshot
1. Postbit with display as user, custom avatar and Remove Ads text link enabled.
2. Postbit with ads displayed as standard, display as user disabled.
3. Postbit_legacy with display as user enabled, custom avatar disabled.
4.Random ads (pictures of Bart Simpon in this case) in left & right columns, in the header and after the 1st thread on a page of threads (sticky threads aren't counted in the positions).
5. Positions of adverts in the archives.



Changelog
v2.0 Released.
v2.01 Fixed bug where static header ads will not show up, plus minor instructions typo fix.
v2.02 (Unreleased) Fixed me forgetting to update Usergroup & UserID permissions from v1.0.

v2.1 Added advertisements in archives using header, footer, left & right columns.
v2.1 Fixed Usergroup & UserID permissions.
v2.1 Fixed Google Analytics causing footer problems.
v2.1 Minor XHTML validation fix.
v2.1 Minor optimisations.

v3.0 BETA Added significant Adsharing features.

v3.01 BETA Added custom delimiters for both Adcode sharing and all Adcode and settings. This means that you can choose to separate your settings and Adcode with , or | or ;; or any string of characters you wish without editing the code. You can also do the same allowing you to alter what text is shared, previously you had to use #shared#.
v3.01 BETA Added blocking a user from seeing their own shared advertisements.
v3.01 BETA Fixed bug where Usergroup blocking would not work.
v3.01 BETA Minor optimisations.

v3.02 No longer BETA, full release.
v3.02 Fixed shared postbit ads not showing.

v3.03 Removed the BETA tag from the version.
v3.03 Fixed error when using threadbit ads.
v3.03 Removed threadbit ads in archives option, since apparently it doesn't exist.

v3.04 Removed executionorder field from the plugin. It should now also work with vB 3.5.x versions. May be slightly faster too, not sure.
v3.04 Fixed template error where an advertisement's forum statusicon would break if quotes were used in the Sponsored Links text. Revert your template after upgrading if this needs fixing for you.
v3.04 Updated copyright link insertion to improve speed and be compatible with other modifications by myself that also insert copyright links. The idea is that if you are using several plugins it will detect the others and ensure that only one link is chosen to be added. Currently there is only one other (http://www.vbulletin.org/forum/showthread.php?t=142153) so if you are using that modification you must also upgrade vB Ad Management or two links will be displayed.

v3.1 Added major optimisations, improved forumbit and threadbit code particularly and massively trimmed the number of necessary database queries for shared ads.
v3.1 Added some basic username markup so admins can see whose adcode is being used.
v3.1 Fixed forumbit and thread ads, bit more reliable now.
v3.1 Fixed usergroup and userid banning for shared adcode, again now they actually work.
v3.1 Added automatic ban from shared ads when user is placed in Tachy goes to Coventry.
v3.1 Added option to force use of the thread-starter or last poster's adcode in specified forums.
v3.1 "Remove Advertisements" link extended to be included in almost all advertisement templates.
v3.1 Switch to primarily file-based modification instead of entirely plugin-based.
v3.1 Templates require revert to include the new link.

v3.11 Add % calculation back in. Oops.
v3.11 Added % calculation for shared ads with more accurate, more random formula.

v3.12 Fixed vBSEO compatibility.
v3.12 Fixed and optimised Google Analytics code addition.

v3.13 Fixed postbit_legacy displaying incorrectly when using "Display as user".
v3.13 Fixed removeads link not displaying in postbit_legacy.

v3.14 Fixed repeating copyright link compatibility problem with backup modification and changed the formatting and wording.


Known Issues
v2.x Left/Right column alignment
The padding and alignment of the right and left columns (right column or both together especially) can vary a bit and look uneven. I used the code from vBulletin's Quick Tips section and could not improve upon it myself either so I'm afraid this is probably as good as it gets.
v3.x Shared Adcode not triggering.
If your shared delimiter is the text at the very end of your adcode, then it will not appear when the advert is displayed on your forum and nothing will replace it, or sharing will not be triggered. Your shared delimiter cannot be the last characters in your Adcode.




How to add your own custom adcode blocks in 3 minutes

Download the zip file and open the named php files using a plain text editor (something like MSWord which uses formatting will break the code). Follow the simple instructions below then save, upload and overwrite your existing files. Your new custom adcode block will be at the bottom of the header/footer section of your vB Ad Management settings.

You can add as many custom blocks as you like as long as you give each one a different name. They'll work on any page, obey all permissions and work with all features including Ad-Sharing.

To name a custom adcode block, just find/replace every instance of the word "custom" in the code below with the new name of your choice.


IN FILE vb_ad_management_310.xml, FIND:
PHP:
<template name="footer_advertisement" templatetype="template"><![CDATA[
		<div align="center">
			$footer_adcode
		</div>
]]></template>

ADD BELOW:

PHP:
<template name="custom_advertisement" templatetype="template"><![CDATA[
		<div>
			$custom_adcode
		</div>
]]></template>




IN FILE includes/vb_ad_management/cache_templates.php, FIND:
PHP:
if ($vbulletin->options['adintegrate_footer_onoff'])
{
	$adtemplates[] = 'footer_advertisement';
}

ADD ABOVE:
PHP:
if ($vbulletin->options['adintegrate_custom_onoff'])
{
	$adtemplates[] = 'custom_advertisement';
}




IN FILE includes/vb_ad_management/global_start.php,FIND:
PHP:
if ($vbulletin->options['adintegrate_footer_onoff'])

ADD ABOVE:
PHP:
if ($vbulletin->options['adintegrate_custom_onoff'])
{	
	if ($vbulletin->options['adintegrate_custom_adcode'])
	{
		$custom_split = explode("$adshared", $vbulletin->options['adintegrate_custom_adcode']);
		$custom_adcode = $custom_split[0];
		if ($custom_split[1])
		{
			$custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1];
		}
		eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";');
	}
	else if ($vbulletin->options['adintegrate_custom_adcode_rand'])
	{
		$custom_adcode = explode("$addelimiter", $vbulletin->options['adintegrate_custom_adcode_rand']);
		$custom_rand = array_rand($custom_adcode);
		$custom_adcode = $custom_adcode["$custom_rand"];
		$custom_split = explode("$adshared", $custom_adcode);
		$custom_adcode = $custom_split[0];
		if ($custom_split[1])
		{
			$custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1];
		}
		eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";');
	}	
}




IN FILE vb_ad_management_310.xml, FIND:
PHP:
<setting varname="adintegrate_footer_adcode_rand" displayorder="45">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>

ADD BELOW:

PHP:
<setting varname="adintegrate_custom_onoff" displayorder="991">
	<datatype>boolean</datatype>
	<optioncode>yesno</optioncode>
	<defaultvalue>0</defaultvalue>
</setting>
<setting varname="adintegrate_custom_adcode" displayorder="992">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>
<setting varname="adintegrate_custom_adcode_rand" displayorder="993">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>
 

Duuuhhude

New Member
= vB Ad Management 3.1 =

What does it do?

A common template modification request is about how to insert advertisements into your forum. This does that and allows you to control when it will appear and how it will look via the AdminCP. Settings are extensive and you can insert any content you like. You can also choose to enable Adsharing (see 2nd post of the thread for details).



Features

Global on/off
Turn the plugin on and off. (Exciting stuff!)

Displays ads with posts, single posts, announcements or private messages
Display advertisements with any form of user message.

Displays ads in your header, footer and in a left or right column, with forum categories and with threads
As well as adverts only being previously displayed with threads, you can now include advertisements in all these locations via the AdminCP.

Unlimited customisation at every advertisement location
Every ad location is templated and editable and also offers extensive customisation via the AdminCP. You can choose between static ad code (i.e. Adsense) or a random banner rotation at every location and can use individual code for each type at each location. Display settings below apply either globally and where appropriate to each individual location. Each location can be separately enabled or disabled and postbit advertisements (announcements, private messages, posts) can now also be separately enabled or disabled.

Include or exclude display of advertisements:
  • Per Forum
  • Per Usergroup
  • Per Thread
  • Per User
  • Per Announcement or turn announcement ads on/off
  • Private message ads on/off

Exclude only:
  • THIS_SCRIPT - Allows you to exclude pages from displaying ads based on content type, necessary for some TOS. See the setting explanation in the product AdminCP for more details.

Display using any combination of:
  • Display with first post on a page
  • Display with last post on a page
  • Display every X posts
  • Display with Xth post in a thread
  • Minimum thread postcount before ads will be displayed
  • User postcount - after X posts advertisements will not be displayed.

Remove Ads link
Adds a link with ads to information about upgrading an account to remove advertisements. Custom link & link text, can be turned on/off. You can now also specify the "Sponsored Links" text yourself.

Display ads as user
Choose between displaying advertisments as a post (with optional custom avatar) and standard advertisement display.

Automatic postbit switch
The one-phrase template edit is the same no matter what your settings, you can change between any combination of postbit/postbit_legacy and display as user/standard display at any time and the style will automatically adjust itself.

Displays any code
Anything which can be copied and pasted into the text box will be displayed, HTML included of course. This applies to both the static and random banners. There is no limit to how many banners you can rotate, or filetype, nor for that matter does it even have to be a banner. It will randomly rotate any code you input. Note: It really is random, so you may see the same banner twice in a row.

Google Analytics integration
You can enter your Google Analytics code into vB Ad Management settings and it will be automatically inserted into every page. Aside from saving you a template edit, the analytics can this way be independently turned off.

XHTML valid.
Peace of mind...

Does not cause global warming.
Excellent.

Copyright notice
Ok not a feature, but I felt there is now enough substance as a product to add a link in the footer. If you would like to remove this please make a donation, details below. And be sure to let me know by PM!

This product is my work and mine alone. You are not permitted to distribute it outside of vbulletin.org, take credit for it, etc. Use your common sense and don't steal, basically. I have extremely effective legal recourse against thieves and fraud.



Location names

For ease of use, the locations are referred to by their template names. Once you know what they mean it's a lot clearer, here's a rundown for those who don't know.

Postbit - The postbit template is used to display posts, announcements and private messages.
Threadbit - The threadbit is the template for a single row when viewing a list of threads.
Forumbit - The forumbit is the template for a single row when viewing a list of forums/subforums.
Header - The template containing the logo at the top of your forum pages ONLY. The area immediately below that is the navbar template.
Footer - The template that contains everything at the bottom of your forum pages from the time downward.


Instructions
  • Upload the product using the Product Manager.
  • Go to Style Manager > Edit Templates and...
  • Find <!-- post $post[postid] popup menu --> and paste $postbit_advertisement above it in your postbit & postbit_legacy templates.
  • Paste $forumbit_advertisement at the bottom of your forumhome_forumbit_level1_post and forumhome_forumbit_level2_post templates.
  • Paste $threadbit_advertisement at the bottom of your threadbit template.
  • Paste $footer_advertisement at the top of your footer template.
  • Find $spacer_close in your footer template and below it paste $rightcolumn_advertisement.
  • Find &nbsp; in your header template and replace it with $header_advertisement.
  • Find $spacer_open in your header template and below it paste $leftcolumn_advertisement.


Changing the settings
  • The AdminCP options where you can change your settings are located in vBulletin Options after all the rest of the setting categories.
  • If you want to edit the templates for the advertisements yourself, they are located immediately after their postbit counterparts in the Template Manager list with the suffix "_advertisement". Do not alter any value in the template (that's a string of words or letters beginning with a $ sign) or your ads may stop working! I'll only support the unedited product.

    Important! You cannot see your own shared advertisements! This is to avoid accidentally breaking advertiser's TOS by clicking your own ads. Remember this when testing and be sure to test using someone else's adcode!


Donations

If you have a pressing wish to donate money to me (and of course, you do) to say thank you and to possibly encourage more future work then you can do via the link below. Also, you will go to heaven.

http://redtyger.co.uk/donations.php

Don't panic!
The donations link is only hosted on my website so it can be encrypted and not open my email address to spammers.



Screenshot
1. Postbit with display as user, custom avatar and Remove Ads text link enabled.
2. Postbit with ads displayed as standard, display as user disabled.
3. Postbit_legacy with display as user enabled, custom avatar disabled.
4.Random ads (pictures of Bart Simpon in this case) in left & right columns, in the header and after the 1st thread on a page of threads (sticky threads aren't counted in the positions).
5. Positions of adverts in the archives.



Changelog
v2.0 Released.
v2.01 Fixed bug where static header ads will not show up, plus minor instructions typo fix.
v2.02 (Unreleased) Fixed me forgetting to update Usergroup & UserID permissions from v1.0.

v2.1 Added advertisements in archives using header, footer, left & right columns.
v2.1 Fixed Usergroup & UserID permissions.
v2.1 Fixed Google Analytics causing footer problems.
v2.1 Minor XHTML validation fix.
v2.1 Minor optimisations.

v3.0 BETA Added significant Adsharing features.

v3.01 BETA Added custom delimiters for both Adcode sharing and all Adcode and settings. This means that you can choose to separate your settings and Adcode with , or | or ;; or any string of characters you wish without editing the code. You can also do the same allowing you to alter what text is shared, previously you had to use #shared#.
v3.01 BETA Added blocking a user from seeing their own shared advertisements.
v3.01 BETA Fixed bug where Usergroup blocking would not work.
v3.01 BETA Minor optimisations.

v3.02 No longer BETA, full release.
v3.02 Fixed shared postbit ads not showing.

v3.03 Removed the BETA tag from the version.
v3.03 Fixed error when using threadbit ads.
v3.03 Removed threadbit ads in archives option, since apparently it doesn't exist.

v3.04 Removed executionorder field from the plugin. It should now also work with vB 3.5.x versions. May be slightly faster too, not sure.
v3.04 Fixed template error where an advertisement's forum statusicon would break if quotes were used in the Sponsored Links text. Revert your template after upgrading if this needs fixing for you.
v3.04 Updated copyright link insertion to improve speed and be compatible with other modifications by myself that also insert copyright links. The idea is that if you are using several plugins it will detect the others and ensure that only one link is chosen to be added. Currently there is only one other (http://www.vbulletin.org/forum/showthread.php?t=142153) so if you are using that modification you must also upgrade vB Ad Management or two links will be displayed.

v3.1 Added major optimisations, improved forumbit and threadbit code particularly and massively trimmed the number of necessary database queries for shared ads.
v3.1 Added some basic username markup so admins can see whose adcode is being used.
v3.1 Fixed forumbit and thread ads, bit more reliable now.
v3.1 Fixed usergroup and userid banning for shared adcode, again now they actually work.
v3.1 Added automatic ban from shared ads when user is placed in Tachy goes to Coventry.
v3.1 Added option to force use of the thread-starter or last poster's adcode in specified forums.
v3.1 "Remove Advertisements" link extended to be included in almost all advertisement templates.
v3.1 Switch to primarily file-based modification instead of entirely plugin-based.
v3.1 Templates require revert to include the new link.

v3.11 Add % calculation back in. Oops.
v3.11 Added % calculation for shared ads with more accurate, more random formula.

v3.12 Fixed vBSEO compatibility.
v3.12 Fixed and optimised Google Analytics code addition.

v3.13 Fixed postbit_legacy displaying incorrectly when using "Display as user".
v3.13 Fixed removeads link not displaying in postbit_legacy.

v3.14 Fixed repeating copyright link compatibility problem with backup modification and changed the formatting and wording.


Known Issues
v2.x Left/Right column alignment
The padding and alignment of the right and left columns (right column or both together especially) can vary a bit and look uneven. I used the code from vBulletin's Quick Tips section and could not improve upon it myself either so I'm afraid this is probably as good as it gets.
v3.x Shared Adcode not triggering.
If your shared delimiter is the text at the very end of your adcode, then it will not appear when the advert is displayed on your forum and nothing will replace it, or sharing will not be triggered. Your shared delimiter cannot be the last characters in your Adcode.




How to add your own custom adcode blocks in 3 minutes

Download the zip file and open the named php files using a plain text editor (something like MSWord which uses formatting will break the code). Follow the simple instructions below then save, upload and overwrite your existing files. Your new custom adcode block will be at the bottom of the header/footer section of your vB Ad Management settings.

You can add as many custom blocks as you like as long as you give each one a different name. They'll work on any page, obey all permissions and work with all features including Ad-Sharing.

To name a custom adcode block, just find/replace every instance of the word "custom" in the code below with the new name of your choice.


IN FILE vb_ad_management_310.xml, FIND:
PHP:
<template name="footer_advertisement" templatetype="template"><![CDATA[
		<div align="center">
			$footer_adcode
		</div>
]]></template>

ADD BELOW:

PHP:
<template name="custom_advertisement" templatetype="template"><![CDATA[
		<div>
			$custom_adcode
		</div>
]]></template>




IN FILE includes/vb_ad_management/cache_templates.php, FIND:
PHP:
if ($vbulletin->options['adintegrate_footer_onoff'])
{
	$adtemplates[] = 'footer_advertisement';
}

ADD ABOVE:
PHP:
if ($vbulletin->options['adintegrate_custom_onoff'])
{
	$adtemplates[] = 'custom_advertisement';
}




IN FILE includes/vb_ad_management/global_start.php,FIND:
PHP:
if ($vbulletin->options['adintegrate_footer_onoff'])

ADD ABOVE:
PHP:
if ($vbulletin->options['adintegrate_custom_onoff'])
{	
	if ($vbulletin->options['adintegrate_custom_adcode'])
	{
		$custom_split = explode("$adshared", $vbulletin->options['adintegrate_custom_adcode']);
		$custom_adcode = $custom_split[0];
		if ($custom_split[1])
		{
			$custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1];
		}
		eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";');
	}
	else if ($vbulletin->options['adintegrate_custom_adcode_rand'])
	{
		$custom_adcode = explode("$addelimiter", $vbulletin->options['adintegrate_custom_adcode_rand']);
		$custom_rand = array_rand($custom_adcode);
		$custom_adcode = $custom_adcode["$custom_rand"];
		$custom_split = explode("$adshared", $custom_adcode);
		$custom_adcode = $custom_split[0];
		if ($custom_split[1])
		{
			$custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1];
		}
		eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";');
	}	
}




IN FILE vb_ad_management_310.xml, FIND:
PHP:
<setting varname="adintegrate_footer_adcode_rand" displayorder="45">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>

ADD BELOW:

PHP:
<setting varname="adintegrate_custom_onoff" displayorder="991">
	<datatype>boolean</datatype>
	<optioncode>yesno</optioncode>
	<defaultvalue>0</defaultvalue>
</setting>
<setting varname="adintegrate_custom_adcode" displayorder="992">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>
<setting varname="adintegrate_custom_adcode_rand" displayorder="993">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>
 

Duuuhhude

New Member
= vB Ad Management 3.1 =

What does it do?

A common template modification request is about how to insert advertisements into your forum. This does that and allows you to control when it will appear and how it will look via the AdminCP. Settings are extensive and you can insert any content you like. You can also choose to enable Adsharing (see 2nd post of the thread for details).



Features

Global on/off
Turn the plugin on and off. (Exciting stuff!)

Displays ads with posts, single posts, announcements or private messages
Display advertisements with any form of user message.

Displays ads in your header, footer and in a left or right column, with forum categories and with threads
As well as adverts only being previously displayed with threads, you can now include advertisements in all these locations via the AdminCP.

Unlimited customisation at every advertisement location
Every ad location is templated and editable and also offers extensive customisation via the AdminCP. You can choose between static ad code (i.e. Adsense) or a random banner rotation at every location and can use individual code for each type at each location. Display settings below apply either globally and where appropriate to each individual location. Each location can be separately enabled or disabled and postbit advertisements (announcements, private messages, posts) can now also be separately enabled or disabled.

Include or exclude display of advertisements:
  • Per Forum
  • Per Usergroup
  • Per Thread
  • Per User
  • Per Announcement or turn announcement ads on/off
  • Private message ads on/off

Exclude only:
  • THIS_SCRIPT - Allows you to exclude pages from displaying ads based on content type, necessary for some TOS. See the setting explanation in the product AdminCP for more details.

Display using any combination of:
  • Display with first post on a page
  • Display with last post on a page
  • Display every X posts
  • Display with Xth post in a thread
  • Minimum thread postcount before ads will be displayed
  • User postcount - after X posts advertisements will not be displayed.

Remove Ads link
Adds a link with ads to information about upgrading an account to remove advertisements. Custom link & link text, can be turned on/off. You can now also specify the "Sponsored Links" text yourself.

Display ads as user
Choose between displaying advertisments as a post (with optional custom avatar) and standard advertisement display.

Automatic postbit switch
The one-phrase template edit is the same no matter what your settings, you can change between any combination of postbit/postbit_legacy and display as user/standard display at any time and the style will automatically adjust itself.

Displays any code
Anything which can be copied and pasted into the text box will be displayed, HTML included of course. This applies to both the static and random banners. There is no limit to how many banners you can rotate, or filetype, nor for that matter does it even have to be a banner. It will randomly rotate any code you input. Note: It really is random, so you may see the same banner twice in a row.

Google Analytics integration
You can enter your Google Analytics code into vB Ad Management settings and it will be automatically inserted into every page. Aside from saving you a template edit, the analytics can this way be independently turned off.

XHTML valid.
Peace of mind...

Does not cause global warming.
Excellent.

Copyright notice
Ok not a feature, but I felt there is now enough substance as a product to add a link in the footer. If you would like to remove this please make a donation, details below. And be sure to let me know by PM!

This product is my work and mine alone. You are not permitted to distribute it outside of vbulletin.org, take credit for it, etc. Use your common sense and don't steal, basically. I have extremely effective legal recourse against thieves and fraud.



Location names

For ease of use, the locations are referred to by their template names. Once you know what they mean it's a lot clearer, here's a rundown for those who don't know.

Postbit - The postbit template is used to display posts, announcements and private messages.
Threadbit - The threadbit is the template for a single row when viewing a list of threads.
Forumbit - The forumbit is the template for a single row when viewing a list of forums/subforums.
Header - The template containing the logo at the top of your forum pages ONLY. The area immediately below that is the navbar template.
Footer - The template that contains everything at the bottom of your forum pages from the time downward.


Instructions
  • Upload the product using the Product Manager.
  • Go to Style Manager > Edit Templates and...
  • Find <!-- post $post[postid] popup menu --> and paste $postbit_advertisement above it in your postbit & postbit_legacy templates.
  • Paste $forumbit_advertisement at the bottom of your forumhome_forumbit_level1_post and forumhome_forumbit_level2_post templates.
  • Paste $threadbit_advertisement at the bottom of your threadbit template.
  • Paste $footer_advertisement at the top of your footer template.
  • Find $spacer_close in your footer template and below it paste $rightcolumn_advertisement.
  • Find &nbsp; in your header template and replace it with $header_advertisement.
  • Find $spacer_open in your header template and below it paste $leftcolumn_advertisement.


Changing the settings
  • The AdminCP options where you can change your settings are located in vBulletin Options after all the rest of the setting categories.
  • If you want to edit the templates for the advertisements yourself, they are located immediately after their postbit counterparts in the Template Manager list with the suffix "_advertisement". Do not alter any value in the template (that's a string of words or letters beginning with a $ sign) or your ads may stop working! I'll only support the unedited product.

    Important! You cannot see your own shared advertisements! This is to avoid accidentally breaking advertiser's TOS by clicking your own ads. Remember this when testing and be sure to test using someone else's adcode!


Donations

If you have a pressing wish to donate money to me (and of course, you do) to say thank you and to possibly encourage more future work then you can do via the link below. Also, you will go to heaven.

http://redtyger.co.uk/donations.php

Don't panic!
The donations link is only hosted on my website so it can be encrypted and not open my email address to spammers.



Screenshot
1. Postbit with display as user, custom avatar and Remove Ads text link enabled.
2. Postbit with ads displayed as standard, display as user disabled.
3. Postbit_legacy with display as user enabled, custom avatar disabled.
4.Random ads (pictures of Bart Simpon in this case) in left & right columns, in the header and after the 1st thread on a page of threads (sticky threads aren't counted in the positions).
5. Positions of adverts in the archives.



Changelog
v2.0 Released.
v2.01 Fixed bug where static header ads will not show up, plus minor instructions typo fix.
v2.02 (Unreleased) Fixed me forgetting to update Usergroup & UserID permissions from v1.0.

v2.1 Added advertisements in archives using header, footer, left & right columns.
v2.1 Fixed Usergroup & UserID permissions.
v2.1 Fixed Google Analytics causing footer problems.
v2.1 Minor XHTML validation fix.
v2.1 Minor optimisations.

v3.0 BETA Added significant Adsharing features.

v3.01 BETA Added custom delimiters for both Adcode sharing and all Adcode and settings. This means that you can choose to separate your settings and Adcode with , or | or ;; or any string of characters you wish without editing the code. You can also do the same allowing you to alter what text is shared, previously you had to use #shared#.
v3.01 BETA Added blocking a user from seeing their own shared advertisements.
v3.01 BETA Fixed bug where Usergroup blocking would not work.
v3.01 BETA Minor optimisations.

v3.02 No longer BETA, full release.
v3.02 Fixed shared postbit ads not showing.

v3.03 Removed the BETA tag from the version.
v3.03 Fixed error when using threadbit ads.
v3.03 Removed threadbit ads in archives option, since apparently it doesn't exist.

v3.04 Removed executionorder field from the plugin. It should now also work with vB 3.5.x versions. May be slightly faster too, not sure.
v3.04 Fixed template error where an advertisement's forum statusicon would break if quotes were used in the Sponsored Links text. Revert your template after upgrading if this needs fixing for you.
v3.04 Updated copyright link insertion to improve speed and be compatible with other modifications by myself that also insert copyright links. The idea is that if you are using several plugins it will detect the others and ensure that only one link is chosen to be added. Currently there is only one other (http://www.vbulletin.org/forum/showthread.php?t=142153) so if you are using that modification you must also upgrade vB Ad Management or two links will be displayed.

v3.1 Added major optimisations, improved forumbit and threadbit code particularly and massively trimmed the number of necessary database queries for shared ads.
v3.1 Added some basic username markup so admins can see whose adcode is being used.
v3.1 Fixed forumbit and thread ads, bit more reliable now.
v3.1 Fixed usergroup and userid banning for shared adcode, again now they actually work.
v3.1 Added automatic ban from shared ads when user is placed in Tachy goes to Coventry.
v3.1 Added option to force use of the thread-starter or last poster's adcode in specified forums.
v3.1 "Remove Advertisements" link extended to be included in almost all advertisement templates.
v3.1 Switch to primarily file-based modification instead of entirely plugin-based.
v3.1 Templates require revert to include the new link.

v3.11 Add % calculation back in. Oops.
v3.11 Added % calculation for shared ads with more accurate, more random formula.

v3.12 Fixed vBSEO compatibility.
v3.12 Fixed and optimised Google Analytics code addition.

v3.13 Fixed postbit_legacy displaying incorrectly when using "Display as user".
v3.13 Fixed removeads link not displaying in postbit_legacy.

v3.14 Fixed repeating copyright link compatibility problem with backup modification and changed the formatting and wording.


Known Issues
v2.x Left/Right column alignment
The padding and alignment of the right and left columns (right column or both together especially) can vary a bit and look uneven. I used the code from vBulletin's Quick Tips section and could not improve upon it myself either so I'm afraid this is probably as good as it gets.
v3.x Shared Adcode not triggering.
If your shared delimiter is the text at the very end of your adcode, then it will not appear when the advert is displayed on your forum and nothing will replace it, or sharing will not be triggered. Your shared delimiter cannot be the last characters in your Adcode.




How to add your own custom adcode blocks in 3 minutes

Download the zip file and open the named php files using a plain text editor (something like MSWord which uses formatting will break the code). Follow the simple instructions below then save, upload and overwrite your existing files. Your new custom adcode block will be at the bottom of the header/footer section of your vB Ad Management settings.

You can add as many custom blocks as you like as long as you give each one a different name. They'll work on any page, obey all permissions and work with all features including Ad-Sharing.

To name a custom adcode block, just find/replace every instance of the word "custom" in the code below with the new name of your choice.


IN FILE vb_ad_management_310.xml, FIND:
PHP:
<template name="footer_advertisement" templatetype="template"><![CDATA[
		<div align="center">
			$footer_adcode
		</div>
]]></template>

ADD BELOW:

PHP:
<template name="custom_advertisement" templatetype="template"><![CDATA[
		<div>
			$custom_adcode
		</div>
]]></template>




IN FILE includes/vb_ad_management/cache_templates.php, FIND:
PHP:
if ($vbulletin->options['adintegrate_footer_onoff'])
{
	$adtemplates[] = 'footer_advertisement';
}

ADD ABOVE:
PHP:
if ($vbulletin->options['adintegrate_custom_onoff'])
{
	$adtemplates[] = 'custom_advertisement';
}




IN FILE includes/vb_ad_management/global_start.php,FIND:
PHP:
if ($vbulletin->options['adintegrate_footer_onoff'])

ADD ABOVE:
PHP:
if ($vbulletin->options['adintegrate_custom_onoff'])
{	
	if ($vbulletin->options['adintegrate_custom_adcode'])
	{
		$custom_split = explode("$adshared", $vbulletin->options['adintegrate_custom_adcode']);
		$custom_adcode = $custom_split[0];
		if ($custom_split[1])
		{
			$custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1];
		}
		eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";');
	}
	else if ($vbulletin->options['adintegrate_custom_adcode_rand'])
	{
		$custom_adcode = explode("$addelimiter", $vbulletin->options['adintegrate_custom_adcode_rand']);
		$custom_rand = array_rand($custom_adcode);
		$custom_adcode = $custom_adcode["$custom_rand"];
		$custom_split = explode("$adshared", $custom_adcode);
		$custom_adcode = $custom_split[0];
		if ($custom_split[1])
		{
			$custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1];
		}
		eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";');
	}	
}




IN FILE vb_ad_management_310.xml, FIND:
PHP:
<setting varname="adintegrate_footer_adcode_rand" displayorder="45">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>

ADD BELOW:

PHP:
<setting varname="adintegrate_custom_onoff" displayorder="991">
	<datatype>boolean</datatype>
	<optioncode>yesno</optioncode>
	<defaultvalue>0</defaultvalue>
</setting>
<setting varname="adintegrate_custom_adcode" displayorder="992">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>
<setting varname="adintegrate_custom_adcode_rand" displayorder="993">
	<datatype>free</datatype>
	<optioncode>textarea</optioncode>
</setting>
 

Duuuhhude

New Member
Screenshots:
5vnoqw.jpg
 

vivekwig

New Member
thanks for hack.
i upload it on my site. all is working fine.
but sharing is not working.
i think due to unable to recognise field5 or field6.
plz tell me more about this.
how i can create this.
and tell where the user put their adsense id
 

Mr.X

New Member
To remove copyright:
In includes > vb_ad_management > global_start.php
Look around line 302
PHP:
$vbulletin->options['copyrighttext'] .= '<div class="smallfont" style="text-align:center;">' . $products_rt . ' by <a href="http://redtyger.co.uk">=RedTyger=</a></div>';
Replace with:
PHP:
$vbulletin->options['copyrighttext'] .= '';

@vivek, as far as i remember you have to create a profile fied (text box type in members profile setting page) from your vbadmincp and note that new profile filed no.

and add above new profile filed no. in vb ad sharing system.
 

vivekwig

New Member
thanks for answer for my query mr.x
i am newbie so pplz tell how i can create profile field.
plz explain it
 

Mr.X

New Member
Ok, from your admincp.. left side menu

User Profile Fields > Add New User Profile Field
Profile Field Type- Multiple line text box
 
Top