Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Rotate Ad Banners Based Upon Clock Seconds Details »»
Rotate Ad Banners Based Upon Clock Seconds
Version: 1.00, by Dan Druff Dan Druff is offline
Developer Last Online: May 2023 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 4.1.12 Rating:
Released: 09-18-2012 Last Update: Never Installs: 6
Code Changes  
No support by the author.

One feature sorely missing from vBulletin 4 is the ability to "rotate" ad banners.

I have found other mods that allow you to do this, but they were overly complicated and cumbersome for what I needed.

This is a little hack that allows you to convert the mostly-useless "Display ad when PM storage is between X and X percent" into a rotating ad banner system.

After this mod is implemented, you will be able to specify the time on the clock secondhand when a specific banner is displayed. For example, if you had two banners, you could rotate them equally by displaying one between 0 and 29 seconds, and the other between 30 and 59 seconds.

This requires one code change and one phrase change.

For the code change, go to the includes directory and find functions_ad.php.

Search for:
Code:
                        case "pm_storage_x_percent_full":
Directly BELOW it, delete the following two lines:
Code:
                                                $conditional_prefix .= '<vb:if condition="$' . 'pmboxpercentage = $' . 'bbuserinfo[\'pmtotal\'] / $' . 'bbuserinfo[\'permissions\'][\'pmquota\'] * 100"></vb:if>';
                                                $conditional_prefix .= '<vb:if condition="$' . 'pmboxpercentage > ' . intval($criteria['condition1']) . ' AND $' . 'pmboxpercentage < ' . intval($criteria['condition2']) . '">';

In their place, put the following two lines:
Code:
                                                $conditional_prefix .= '<vb:if condition="$now = (mktime() % 60)"></vb:if>';
                                                $conditional_prefix .= '<vb:if condition="$now >= ' . intval($criteria['condition1']) . ' AND $now <= ' . intval($criteria['condition2']) . '">';

So the block should now look like:
Code:
                        case "pm_storage_x_percent_full":
                                                $conditional_prefix .= '<vb:if condition="$now = (mktime() % 60)"></vb:if>';
                                                $conditional_prefix .= '<vb:if condition="$now >= ' . intval($criteria['condition1']) . ' AND $now <= ' . intval($criteria['condition2']) . '">';
                                                $conditional_postfix .= "</vb:if>";
                                                break;

Now, just for aesthetics, go to Search in Phrases in the Admin Control Panel. Enter pm_storage_x_percent_full_criteria in the Search for Text box. Then click Phrase Variable Name Only under Search in. Then press the Find button.

It should find pm_storage_x_percent_full_criteria. Click the Edit button.

On the edit screen, enter the following in the "Translation" text box:

Code:
Display ad between {1} and {2} seconds
Then press Save and you are all done!


Now you will have a choice to select the seconds on the clock when certain ads are displayed. You set this on the Edit Ad screen. You can rotate up to 60 ads this way. You can even designate certain ads to come up more often than others, by giving some more time than others. For example, if you have Ad #1 display between 0 and 49 seconds, and Ad #2 display between 50 and 59 seconds, Ad #1 will display on average 5 times more often as Ad #2.

I have attached a screen shot of the Edit Ad screen. Notice that I checked the box labeled "Display ad between ____ and ____ seconds". You need to do that in order to enable this modification on any ad you display.

Screenshots

File Type: png editad.png (126.6 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03717 seconds
  • Memory Usage 2,212KB
  • Queries Executed 15 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete