Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Advert Management Details »»
Advert Management
Version: 1.00, by Scott MacVicar Scott MacVicar is offline
Developer Last Online: Mar 2016 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 05-25-2002 Last Update: Never Installs: 47
 
No support by the author.

This is a script to allow you to manage the adverts on your forums, you can have any sort of advert you can imagine there is no actual limit with this hack to what it can be, javascript, flash, image, text and images.

You add adverts to a category or a forum or the whole board. If the category has child forums they will inherit the adverts as well as their own adverts if they have any.
Adverts can have a set exposure such as 10,000 views and once it has reached that it will stop.

It fills a variable called $advert which you just place in any template, such as the header, you can also use variables and replacements within the adverts, such as $bbuserinfo[userid] for the persons userid in a link within an advert.

Updated June 9th at 19:44 GMT

Added date limits and options for unlimited exposures.
To upgrade from an older version, reapply code in global.php, upload ads.php and run this sql query to alter the ads table you made.

[sql]ALTER TABLE `ads` ADD `time` INT(10) DEFAULT '0' NOT NULL;[/sql]

[sql]ALTER TABLE `ads` ADD `wholeforum` SMALLINT(1) DEFAULT '0' NOT NULL;[/sql]
If you already run that query though are still experiencing problems with the time always being January 1st run

[sql]ALTER TABLE `ads` CHANGE `time` `time` INT(10) DEFAULT '0' NOT NULL[/sql]

New features include showing the advert on the entire forum by using a radio button, some highlighting in the admin panel, italic name indicates the time period has ended and a bold name means the advert has met its quota for exposures.

You must chance RAND() to RAND(NOW()) if you have mysql 3.23.52 or above

Scott

Show Your Support

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

Comments
  #142  
Old 12-19-2002, 12:34 PM
SpeedStreet SpeedStreet is offline
 
Join Date: Aug 2002
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would any of my proposed fixes work for this, PPN?
Reply With Quote
  #143  
Old 12-19-2002, 04:04 PM
waherne waherne is offline
 
Join Date: Oct 2002
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PPN,

I modified your hack and have now got it to randomise the adverts successfully. As I said before, I am not a programmer, so my code is probably inefficient in performing the task - when I post the code here, you and others can hopefully assist in that respect.

The only thing with my modification is that I have disabled the 'show on whole board' functionality. Basically, I didn't need it for my purpose.

I'm at work now and don't have access to my laptop. I will post my code to this thread over the next few days.

Once again, thanks for the hack.

Willie
Reply With Quote
  #144  
Old 12-20-2002, 09:34 PM
thakikka thakikka is offline
 
Join Date: Dec 2002
Location: Germany
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I guess I found the error I reported some posts before (banners not shown on directly linked posts).

If the script finds something like "&threadid=19938" then the banner gets displayed.

But if you directly link to a post, it contains "?postid=172199" and the banner does not get displayed.

Can someone fix this so banners get displayed on every page?

Thanks in advance,
Sebastian
Reply With Quote
  #145  
Old 12-22-2002, 08:22 AM
thewolf thewolf is offline
 
Join Date: Dec 2002
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi PPN,

any news on the new version of this hack?

Also, will it work with the latest stable version of Vbulletin (2.2.9)?

Keep up the good work!

Thanks,
Marco.
Reply With Quote
  #146  
Old 12-22-2002, 09:30 AM
waherne waherne is offline
 
Join Date: Oct 2002
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Further to my post above, here are the changes I made to PPN's hack to make it randomise. As I said, let us all work together to make my code more efficient.

Willie

////////////////////START//////////////////////////
In global.php, FIND:

if(isset($advert_forumid)) {
$foruminfo = getforuminfo($advert_forumid);
$advert=$DB_site->query_first("SELECT * FROM ads WHERE LOCATE(CONCAT(',',forumid,','),',$foruminfo[parentlist],')>0 AND

time>=".time()." AND (exposed<=exposures OR exposures=0) ORDER BY RAND()");
} else {
$advert=$DB_site->query_first("SELECT * FROM ads WHERE wholeforum='1' AND time>=".time()." AND (exposed<=exposures OR

exposures=0) ORDER BY RAND()");
}

AND REPLACE IT WITH:

$DB_site;

$sql="SELECT * FROM ads WHERE LOCATE(CONCAT(',',forumid,','),',$foruminfo[parentlist],')>0 AND time>=".time()." AND (exposed<=exposures OR exposures=0) ORDER BY RAND()";

$advert1 = mysql_query($sql);
$advert2 = mysql_query($sql);

$adcounter=0;
while($countrow = mysql_fetch_row($advert1))
{
$adcounter++;
}
$act1=rand(0,$adcounter-1);
$adcounter3=0;
while($countrow3 = mysql_fetch_row($advert2))
{
if($adcounter3==$act1)
{
$DB_site->query("UPDATE ads SET exposed=exposed+1 WHERE adid='$countrow3[0]'");
eval("\$advert = trim(\"".str_replace("\'", "'", addslashes($countrow3[7]))."\");");
}
$adcounter3++;
}

///////////////END///////////////////

I just noticed that there is another block of code that should also be included in the Find It and Replace above, essentially it's the code immediately following that set out above and beginning with $DB_site->query("UPDATE ads SET exposed - one query only.
Reply With Quote
  #147  
Old 12-22-2002, 05:39 PM
SpeedStreet SpeedStreet is offline
 
Join Date: Aug 2002
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now, let me understand you correctly. This code works, but it eliminates the "Show on all forums" functionality?
Reply With Quote
  #148  
Old 12-22-2002, 07:59 PM
waherne waherne is offline
 
Join Date: Oct 2002
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Correct.

Adverts on child forums will be pooled together with adverts on their parent forums (and their parents...) as before. One advert will then be picked from the pool. Therefore, insertion of an advert at the ultimate parent level could be one way of displaying it on the entire forum.

Test my code and see if it suits your needs.

Willie
Reply With Quote
  #149  
Old 12-31-2002, 01:08 AM
quickstang22 quickstang22 is offline
 
Join Date: Dec 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Willie

I tried your fix but lost all my ads. Not one is showing up. I made sure they were not selected for show all fourms. Just had them in child forums

Matt
Reply With Quote
  #150  
Old 01-05-2003, 12:56 AM
themonarch's Avatar
themonarch themonarch is offline
 
Join Date: Jun 2002
Location: Orlando, FL
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Visionray
good thing I read the last few pages of this thread and realized this hack isn't working. Maybe the first post should be updated with that info so people don't go instalilng it to only find out it doesn't work.
mmm, good point VisionRay. I installed this hack and then when it didn't work, I came back in here to read the whole thread and found out it's not working right yet.
Reply With Quote
  #151  
Old 01-05-2003, 06:33 AM
ChurchMedia's Avatar
ChurchMedia ChurchMedia is offline
 
Join Date: Dec 2002
Location: Las Cruces, NM
Posts: 473
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I run this query:

CREATE TABLE `ads` (
`adid` smallint(5) NOT NULL auto_increment,
`name` varchar(25) NOT NULL default '',
`forumid` smallint(5) NOT NULL default '0',
`wholeforum` smallint(1) NOT NULL default '0',
`exposed` smallint(10) NOT NULL default '0',
`exposures` smallint(10) NOT NULL default '0',
`time` int(10) NOT NULL default '0',
`advert` text NOT NULL,
KEY `adid` (`adid`)
);

I get this error:

MySQL said:

You have an error in your SQL syntax near '\'\',
`forumid` smallint(5) NOT NULL default \'0\',
`wholeforum` smallint(' at line 3

Any ideas?
Reply With Quote
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 01:38 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.05081 seconds
  • Memory Usage 2,312KB
  • Queries Executed 25 (?)
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
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete