[Release v2.0.3] Add "Sponsored by" banners to your forum categories

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chen
    Senior Member
    • Jun 2001
    • 8388

    [Release v2.0.3] Add "Sponsored by" banners to your forum categories

    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!

    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="{categ[i][/i]orybackcolor}" colspan="2"><a href="forumdisplay.php?s=$session[sessionhash]&forumid=$forum[forumid]"><normalfont color="{category[i][/i]fontcolor}"><b>$forum[title]</b></normalfont></a>
    	<br><smallfont color="{categor[i][/i]yfontcolor}">$forum[description]</smallfont></td>
    	<td bgcolor="{categoryb[i][/i]ackcolor}" colspan="4"><a href="$forum[sponsorurl]" target="_blank"><img src="{images[i][/i]folder}/$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!
    Last edited by Chen; Wed 29 Aug '01, 7:10am.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב
  • TWTCommish
    Senior Member
    • Jul 2000
    • 664

    #2
    Looks interesting. Perhaps I'll give it a try.
    Movie Forums - Now With 28% More Bruce Willis

    Comment

    • George L
      Former vBulletin Support
      • May 2000
      • 32996
      • 3.8.x

      #3
      wow looks nice might try it on my private testing copy

      then again with 2.0.4 soon might not
      :: Always Back Up Forum Database + Attachments BEFORE upgrading !
      :: Nginx SPDY SSL - World Flags Demo [video results]
      :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

      Comment

      • Chen
        Senior Member
        • Jun 2001
        • 8388

        #4
        Thanks.

        What do you mean "with 2.0.4 soon might not"?
        This feature is gonna be on 2.0.4?
        Awesome!
        Chen Avinadav
        Better to remain silent and be thought a fool than to speak out and remove all doubt.

        גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

        Comment

        • George L
          Former vBulletin Support
          • May 2000
          • 32996
          • 3.8.x

          #5
          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!
          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
          :: Always Back Up Forum Database + Attachments BEFORE upgrading !
          :: Nginx SPDY SSL - World Flags Demo [video results]
          :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

          Comment

          • Chen
            Senior Member
            • Jun 2001
            • 8388

            #6
            Oh ok, gotcha.
            Chen Avinadav
            Better to remain silent and be thought a fool than to speak out and remove all doubt.

            גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

            Comment

            • Kier
              Former Lead Developer, vBulletin
              • Sep 2000
              • 8179

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

              Comment

              • Chen
                Senior Member
                • Jun 2001
                • 8388

                #8
                Expedition?
                Are they gonna be on National Geographic, like all those people who're going to Alaska and places like that?
                Chen Avinadav
                Better to remain silent and be thought a fool than to speak out and remove all doubt.

                גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                Comment

                • George L
                  Former vBulletin Support
                  • May 2000
                  • 32996
                  • 3.8.x

                  #9
                  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
                  :: Always Back Up Forum Database + Attachments BEFORE upgrading !
                  :: Nginx SPDY SSL - World Flags Demo [video results]
                  :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

                  Comment

                  • Lordmusic
                    Member
                    • Dec 2000
                    • 72

                    #10
                    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.

                    Comment

                    • Chen
                      Senior Member
                      • Jun 2001
                      • 8388

                      #11
                      Ok...
                      Chen Avinadav
                      Better to remain silent and be thought a fool than to speak out and remove all doubt.

                      גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                      Comment

                      • TWTCommish
                        Senior Member
                        • Jul 2000
                        • 664

                        #12
                        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. TV told me so...

                        Where did James/John go?
                        Movie Forums - Now With 28% More Bruce Willis

                        Comment

                        • mjames
                          Senior Member
                          • Nov 2000
                          • 1076
                          • 3.8.x

                          #13
                          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. TV told me so...

                          Where did James/John go?
                          My guess? Somewhere out in the Bahamas burning their millions of dollars from vBulletin.
                          Marc James
                          Sports Central — Beyond the Scores
                          Sports Central Message Boards

                          Comment

                          • BradC
                            Senior Member
                            • May 2001
                            • 510

                            #14
                            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..

                            Comment

                            • BradC
                              Senior Member
                              • May 2001
                              • 510

                              #15
                              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..

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...