vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Add "Sponsored by" banners to your forum categories (https://vborg.vbsupport.ru/showthread.php?t=26818)

Admin 08-28-2001 10:00 PM

Works with vBulletin v2.2.0!

This hack will allow you to add banners to your categories row (like done on SitePointForum.com - use that as a demo ;)).
You can add / remove sponsors for any category that exists and also on creation (of category) time.
You can specify the name, banner url and the sponsor's site.
Currently it only supports categories from level 1, and only on forum index. -if you want more please tell and I'll see what I can do.
Umm, that's it I think. Installation is fairly easy (and the hack itself didn't take too much time :)), so you shouldn't have any problems.

Feedback from any kind is very appreciated! :D

First of all, run the following query
Code:

ALTER TABLE forum ADD sponsorname VARCHAR(100) not null AFTER cancontainthreads, ADD sponsorimg VARCHAR(100) not null AFTER sponsorname, ADD sponsorurl VARCHAR(255) not null AFTER sponsorimg
For more info about running queries take a look here or here.

Add a custom template, name it forumhome_forumbit_level1_nopost_sponsor and put the following in it:
Code:

<tr id="cat">
        <td bgcolor="{categorybackcolor}" colspan="2"><a href="forumdisplay.php?s=$session[sessionhash]&forumid=$forum[forumid]"><normalfont color="{categoryfontcolor}"><b>$forum[title]</b></normalfont></a>
        <br><smallfont color="{categoryfontcolor}">$forum[description]</smallfont></td>
        <td bgcolor="{categorybackcolor}" colspan="4"><a href="$forum[sponsorurl]" target="_blank"><img src="{imagesfolder}/$forum[sponsorimg]" border="0" alt="Proudly sponsored by $forum[sponsorname]"></a></td>
</tr>

(You can tweak this for your tables. Playing around with the colspans should be enough though. This is for the default table structure)

In forum.php (under your admin folder) add
PHP Code:

  maketableheader("Sponsors</b> <i>Only supported by categories</i>","",0);

  
makeinputcode("Sponsor name","sponsorname");
  
makeinputcode("Sponsor banner file<br>(your default images folder is added, no need in that)","sponsorimg");
  
makeinputcode("Sponsor full URL","sponsorurl"); 

right after
PHP Code:

  makeyesnocode("Count posts made in this forum towards user post counts?","countposts",1); 

(around line 121)

Still in forum.php, replace
PHP Code:

  $DB_site->query("INSERT INTO forum
                      (forumid,styleid,title,description,active,displayorder,parentid,
                       parentlist,allowposting,cancontainthreads,daysprune,newpostemail,newthreademail,
                       moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
                       styleoverride,allowratings,countposts,moderateattach)
                   VALUES
                      (NULL,'
$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
                       '','
$allowposting','$cancontainthreads','$daysprune','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
                       '
$moderatenew','$aallowhtmlcode','$aallowbbcode','$aallowimgcode','$aallowsmilies','$aallowicons',
                       '
$styleoverride','$allowratings','$countposts','$moderateattach')"); 

with
PHP Code:

  $DB_site->query("INSERT INTO forum
                      (forumid,styleid,title,description,active,displayorder,parentid,
                       parentlist,allowposting,cancontainthreads,sponsorname,sponsorimg,
                       sponsorurl,daysprune,newpostemail,newthreademail,
                       moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
                       styleoverride,allowratings,countposts,moderateattach)
                   VALUES
                      (NULL,'
$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
                       '','
$allowposting','$cancontainthreads','".addslashes($sponsorname)."','".addslashes($sponsorimg)."',
                       '"
.addslashes($sponsorurl)."','$daysprune','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
                       '
$moderatenew','$aallowhtmlcode','$aallowbbcode','$aallowimgcode','$aallowsmilies','$aallowicons',
                       '
$styleoverride','$allowratings','$countposts','$moderateattach')"); 

(around lines 136-147)

Still in forum.php, add
PHP Code:

  maketableheader("Sponsors</b> <i>Only supported by categories</i>","",0);

  
makeinputcode("Sponsor name","sponsorname",$forum[sponsorname]);
  
makeinputcode("Sponsor banner file<br>(your default images folder is added, no need in that)","sponsorimg",$forum[sponsorimg]);
  
makeinputcode("Sponsor full URL","sponsorurl",$forum[sponsorurl]); 

right after
PHP Code:

  makeyesnocode("Count posts made in this forum towards user post counts?","countposts",$forum[countposts]); 

(around line 230)

Still in forum.php, replace
PHP Code:

  $DB_site->query("UPDATE forum
                   SET
                     styleid='
$styleset', title='".addslashes($title)."', description='".addslashes($description)."',
                     active='
$isactive', displayorder='$displayorder', parentid='$parentid', parentlist=$parentlist,
                     allowposting='
$allowposting', cancontainthreads='$cancontainthreads', daysprune='$daysprune',
                     newpostemail='"
.addslashes($newpostemail)."', newthreademail='".addslashes($newthreademail)."',
                     moderatenew='
$moderatenew', allowhtml='$aallowhtmlcode', allowbbcode='$aallowbbcode',
                     allowimages='
$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons',
                     styleoverride='
$styleoverride', allowratings='$allowratings', countposts='$countposts',
                     moderateattach='
$moderateattach'
                   WHERE forumid='
$forumid'"); 

with
PHP Code:

  $DB_site->query("UPDATE forum
                   SET
                     styleid='
$styleset', title='".addslashes($title)."', description='".addslashes($description)."',
                     active='
$isactive', displayorder='$displayorder', parentid='$parentid', parentlist=$parentlist,
                     allowposting='
$allowposting', cancontainthreads='$cancontainthreads',
                     sponsorname='"
.addslashes($sponsorname)."',sponsorimg='".addslashes($sponsorimg)."',
                     sponsorurl='"
.addslashes($sponsorurl)."',daysprune='$daysprune',
                     newpostemail='"
.addslashes($newpostemail)."', newthreademail='".addslashes($newthreademail)."',
                     moderatenew='
$moderatenew', allowhtml='$aallowhtmlcode', allowbbcode='$aallowbbcode',
                     allowimages='
$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons',
                     styleoverride='
$styleoverride', allowratings='$allowratings', countposts='$countposts',
                     moderateattach='
$moderateattach'
                   WHERE forumid='
$forumid'"); 

(around lines 261-273)
Save and upload forum.php.

In index.php (the main folder) replace this line
PHP Code:

        eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";"); 

with this code
PHP Code:

        if ($forum['sponsorimg'] && $forum['cancontainthreads']==&& $depth==1) {
          eval(
"\$forumbits .= \"".gettemplate("forumhome_forumbit_level1_nopost_sponsor")."\";");
        } else {
          eval(
"\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
        } 

(around line 298)
Save and upload index.php.

That's it.
If you did everything correctly (it wasn't very hard, was it? :)) and I didn't do any mistakes (it's tested alright!, but I might have forgot something to post), you can start adding sponsors to your forum!

TWTCommish 08-29-2001 02:14 PM

Looks interesting. Perhaps I'll give it a try. :)

eva2000 08-29-2001 02:20 PM

wow looks nice might try it on my private testing copy :)

then again with 2.0.4 soon might not :D

Admin 08-29-2001 02:49 PM

Thanks. :)

What do you mean "with 2.0.4 soon might not"?
This feature is gonna be on 2.0.4?
Awesome! :D

eva2000 08-29-2001 02:51 PM

Quote:

Originally posted by FireFly
Thanks. :)

What do you mean "with 2.0.4 soon might not"?
This feature is gonna be on 2.0.4?
Awesome! :D

no what i mean is i might not install this hack until after 2.0.4 is released save me the trouble of rehacking this in :)

Admin 08-29-2001 02:53 PM

Oh ok, gotcha. :)

Kier 08-30-2001 07:42 AM

2.0.4 should be released shortly after John and James return from their expedition

Admin 08-30-2001 07:47 AM

Expedition?
Are they gonna be on National Geographic, like all those people who're going to Alaska and places like that?

eva2000 08-30-2001 07:52 AM

Quote:

Originally posted by FireFly
Expedition?
Are they gonna be on National Geographic, like all those people who're going to Alaska and places like that?

LOL

Lordmusic 08-30-2001 08:59 AM

Don't dis Alaska. I LIVE IN ALASKA. Me = Alaskan Pimp.

Anyways Alaska is cool, and for your info, we don't live in friggin igloos.

Admin 08-30-2001 09:52 AM

Ok...

TWTCommish 08-30-2001 02:36 PM

Sure ya do. I saw it on TV! All people in Alaska wear big brown fluffy coats, live in igloos, have dark tan skin, and eat Eskimo Pie. :D TV told me so...

Where did James/John go?

mjames 08-30-2001 02:42 PM

Quote:

Originally posted by TWTCommish
Sure ya do. I saw it on TV! All people in Alaska wear big brown fluffy coats, live in igloos, have dark tan skin, and eat Eskimo Pie. :D TV told me so...

Where did James/John go?

My guess? Somewhere out in the Bahamas burning their millions of dollars from vBulletin. :)

BradC 08-30-2001 02:49 PM

Quote:

Originally posted by mjames

My guess? Somewhere out in the Bahamas burning their millions of dollars from vBulletin. :)

yah with all that money.... I don't think they will be coming back soon... what was that island tubedogg wanted... maybe they purchased it, and are there.. :)

BradC 08-30-2001 02:51 PM

Quote:

Originally posted by Lordmusic
Don't dis Alaska. I LIVE IN ALASKA. Me = Alaskan Pimp.

Anyways Alaska is cool, and for your info, we don't live in friggin igloos.

Wasn't there a tv show on called something like "Northern Exposure" that was about living and.. umm I working in Alaska.. or was that for somewhere else :)

Ohh... I guess we get the image.. of people living in igloo's... surfing the web and buying stuff off of yahoo.. :)

FreshFroot 08-30-2001 03:58 PM

Great hack...muchas gracias!

Admin 08-30-2001 04:22 PM

[QUOTE]Originally posted by FreshFroot
Great hack...muchas gracias!

amykhar 08-30-2001 04:43 PM

I extended this hack a bit to put a sponsor ad in a particular forum.

To do this, I added a new template called forumdisplay_sponsoredby and put this in it:

PHP Code:

<br><br><a href="$foruminfo[sponsorurl]target="_blank"><img src="{imagesfolder}/$foruminfo[sponsorimg]border="0" alt="Proudly sponsored by $foruminfo[sponsorname]"></a>
<
br

I then edited forumdisplay.php so that

PHP Code:

if ($foruminfo['sponsorimg']) {
  eval(
"\$sponsoredby = \"".gettemplate('forumdisplay_sponsoredby')."\";");
}
else {
  
$sponsoredby '';


was immediately AFTER

PHP Code:

if ($foruminfo['allowposting']==1) {
  eval(
"\$newthreadlink = \"".gettemplate('forumdisplay_newthreadlink')."\";");


and forumdisplay_sponsoredby was included in the list of required templates.

Finally, I added $sponsoredby to my forumdisplay template.

Sorry for the clumsy explanation. It took a bit of putzing around for me to get this to work, but it does. :)

demo:
http://www.eaforums.com/forumdisplay.php?s=&forumid=27


Amy

Admin 08-30-2001 04:51 PM

Good job! :)

eva2000 08-30-2001 07:39 PM

nice extension.. waits for 2.0.4 first :D

FreshFroot 08-31-2001 01:21 PM

Ok...so I've got the hack installed, now how do I add the sponsors?

Admin 08-31-2001 01:26 PM

If you want to add sponsors for existing forums, just edit that forum. (Admin CP => Forums and Moderators => Modify => Edit) :)

FreshFroot 08-31-2001 01:30 PM

Damn your quick! I like your style...thanks :)

FreshFroot 08-31-2001 01:32 PM

I went into the CP and in to Modify Forums and didn't see anything about sponsors. Did I miss a step somewhere?

Admin 08-31-2001 01:36 PM

This is where you should look.

If it doesn't show up there, make sure you edited forum.php correctly and uploaded it. :)

FreshFroot 08-31-2001 01:48 PM

Thanks...I got it corrected, but now my server is acting up!!!

Again...another great hack from FireFly :)

Thomas P 08-31-2001 02:10 PM

Hi FireFly,
awesome, will use it as soon as I found some sponsors
or found a way to use it an other way,
thx and keep up your good work,
-Tom

FreshFroot 08-31-2001 02:19 PM

Check out Comission Junction, you can use affiliate programs for your sponsors. Maybe make some $$$.

Thomas P 08-31-2001 02:34 PM

Thanks for the hint,
am on my way :D
-Tom

Admin 08-31-2001 03:17 PM

Thanks guys! :D

Shoonra 09-03-2001 07:39 PM

That's something I've been looking for! I am PHP-phobic though - never installed a hack in my life (I shiver at the thought of upgrading my forums... I always think I'll end up crashing them!).

Firefly, do you provide support by phone for people in your locality :D I might just need that....

Pie'oh'pah 09-04-2001 12:07 AM

Quote:

Originally posted by Lordmusic
Don't dis Alaska. I LIVE IN ALASKA. Me = Alaskan Pimp.

Anyways Alaska is cool, and for your info, we don't live in friggin igloos.

MUAHAHA Still laughing man!! :D:D

LuBi 09-04-2001 03:01 AM

Everyone who posted in here, the only forum I saw this script on was sitepoint.com did anyone actually install this hack and leave it in?

amykhar 09-04-2001 10:17 AM

I have it running, but I don't show the banners on my main page, just within specific forums. It is still working great though.

I even managed to use this hack to get a sponsor for one of my forums already. It's going to mean extra cash which we can really use right now. :D


Amy

Mark Hewitt 09-04-2001 11:48 AM

This hack would be cool if it gets sponsors for you too! ;)

Admin 09-04-2001 11:56 AM

Hehe. :p

LuBi 09-04-2001 12:00 PM

Well I would install it but I don;t want ot have to uninstall it if I don;t like it. How are th sponsor thingys made? Are they pictures because I read over the read me and it didn't say aything about pictures need to be uploaded.

Mark Hewitt 09-04-2001 12:02 PM

You will need to upload pictures yes.

Admin 09-04-2001 12:05 PM

You can add sponsors selectively for each category.
If there is no sponsor, nothing different will be shown.

LuBi 09-04-2001 12:16 PM

Then I'll be installing this hack, thanks guys.


All times are GMT. The time now is 04:46 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01479 seconds
  • Memory Usage 1,886KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (13)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete