[RELEASE V2.0.1] New Forum Features

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 74092

    [RELEASE V2.0.1] New Forum Features

    Forum Features Hack
    ---- About
    This adds several new options and features to individual forums that can be useful.

    New Features
    1. Meta Tag Keywords set by forum.
    2. Meta Tag Description set by forum.
    3. Robot Meta Tag set by forum.

    New Options
    1. Censor words by Forum.
    2. Minimum Posts required for New Thread.
    3. Minimum Posts to view Forum.

    ---- Credits
    This hack is distributed under the GPL as an add-on to vBulletin. vBulletin is a commercial product and not subject to this license agreement.

    Written by: Wayne Luke
    Portions of the Install script written by: Kier Darby
    vBulletin is created by Jelsoft Ltd. http://www.jelsoft.com

    ---- Installation.
    Run ff_install.php. This will make the modifications to the database and create the new templates.

    Open admin/forum.php and look for:
    PHP Code:
      makeyesnocode("Count posts made in this forum towards user post counts?","countposts",1); 
    After that add:
    PHP Code:
      //WL 04-JUNE-2001 New Forum Features Hack
      
    maketableheader("Search Engine Options (v1.2 by Wayne Luke)");
      
    maketextareacode("Meta Tag Keywords: ","metakey");
      
    maketextareacode("Meta Tag Description","metadesc");
      
    makeinputcode("Meta Robot Tag","robotext");

      
    maketableheader("Forum Control Options (v1.0 by Wayne Luke)");
      
    makeyesnocode("Show in Active Topics?","showactive",1);
      
    makeyesnocode("Censor Words in this Forum","censor",1);
      
    makeinputcode("Minimum Posts to View","minviewposts");
      
    makeinputcode("Minimum Posts to Start New Thread","minposts");
      
    //WL End Modification 
    Also in admin/forum.php Look for:
    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')"); 
    Replace with:
    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,metakey,metadesc,robotext,
       showactive,censor,minviewposts,minposts)
     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',
             '"
    .addslashes($metakey)."','".addslashes($metadesc)."','".addslashes($robotext)."',
             '
    $showactive','$censor','$minviewposts','$minposts')"); 
    After that add:
    PHP Code:
      //WL 04-JUNE-2001 New Forum Features Hack
      
    maketableheader("Search Engine Options (v1.2 by Wayne Luke)");
      
    maketextareacode("Meta Tag Keywords: ","metakey",$forum[metakey]);
      
    maketextareacode("Meta Tag Description","metadesc",$forum[metadesc]);
      
    makeinputcode("Meta Robot Tag","robotext",$forum[robotext]);


      
    maketableheader("Forum Control Options (v1.0 by Wayne Luke)");
      
    makeyesnocode("Show in Active Topics?","showactive",1,$forum[showactive]);
      
    makeyesnocode("Censor Words in this Forum","censor",1,$forum[censor]);
      
    makeinputcode("Minimum Posts to View","minviewposts",$forum[minviewposts]);
      
    makeinputcode("Minimum Posts to Start New Thread","minposts",$forum[minposts]);
      
    //WL End Modification 
    Last edit in admin/forum.php. Find:
    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'"); 
    Replace 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', 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', metakey='".addslashes($metakey)."',metadesc='".addslashes($metadesc)."',robotext='".addslashes($robotext)."',
                         showactive='
    $showactive',censor='$censor',minviewposts='$minviewposts',minposts='$minposts'
                       WHERE forumid='
    $forumid'"); 
    In newthread.php find:
    PHP Code:
      $smilieson=iif($foruminfo[allowsmilies],$ontext,$offtext); 
    After it add:
    PHP Code:
      //WL 04-June-2001 Forum Features Hack (v1.0 Wayne Luke)
      
    if (($foruminfo[minposts]>$bbuserinfo[posts]) and !(ismoderator($foruminfo[forumid],"",$bbuserinfo[userid])) {
        eval(
    "standarderror(\"".gettemplate("error_forumnopost")."\");");
        exit;
      }
      
    //WL End Modifications 
    In newthread.php find:
    PHP Code:
        $subject=censortext($subject);
        
    $message=censortext($message); 
    Replace with:
    PHP Code:
        if ($foruminfo[censor]) {
          
    $subject=censortext($subject);
          
    $message=censortext($message);
        } 
    In Forumdisplay find:
    PHP Code:
    $smilieson=iif($foruminfo['allowsmilies'],$ontext,$offtext); 
    After that add:
    PHP Code:
    //WL 04-June-2001 Forum Features Hack (v1.0 Wayne Luke)
    $keyword=$foruminfo[metakey];
    $description=$foruminfo[metadesc];
    $robotext=$foruminfo[robotext];

    if ((
    $foruminfo[minviewposts]>$bbuserinfo[posts]) and !(ismoderator($foruminfo[forumid],"",$bbuserinfo[userid]))) {
      eval(
    "standarderror(\"".gettemplate("error_forumnoview")."\");");
      exit;
    }
    //WL End Modifications 
    Finally add the following to your forumdisplay template:
    <META NAME="keyword" content="$keyword">
    <META NAME="description" content="$description">
    <META name="robots" content="$robotext">


    These same instructions are included in the readme.txt located in the zip file.
    Last edited by Wayne Luke; Thu 28 Jun '01, 10:25am.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API
  • fastforward
    Senior Member
    • Nov 2000
    • 1013

    #2
    How spooky is that!

    I was sat at my PC last night wondering what the easiest way would be to:

    a) Set meta tags per forum.
    b) Restrict posting and reading individual forums based on posts

    Perfect!
    Thanks for this
    http://britishexpats.com/ - British expatriate community

    Comment

    • RobAC
      Senior Member
      • Jan 2001
      • 1414
      • 3.8.x

      #3
      Whoa! Nice job Wayne!!! Thanks.
      Rob

      Comment

      • Wayne Luke
        vBulletin Technical Support Lead
        • Aug 2000
        • 74092

        #4
        I am glad you like it. Several of the features we have been using at SitePoint so I thought others would like them as well.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API

        Comment

        • Hooper
          Senior Member
          • Apr 2001
          • 1677
          • 3.5.x

          #5
          Thank You.

          Thanks Wayne.

          Comment

          • Wayne Luke
            vBulletin Technical Support Lead
            • Aug 2000
            • 74092

            #6
            The code above has been updated with to correct two bugs that I am surprised didn't cause errors in my testing. Sorry for any inconvenience.

            Thanks to Fastforward for noticing this.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API

            Comment

            • kitchend
              New Member
              • Mar 2001
              • 10

              #7
              just an idea, something we do at BT is to dynamically generate meta-tags and descriptions using information already available.

              as i see it, the information for the meta tags already exists, you just need to use it better.

              you already have the meta-description, by using that forum's description.

              for example this forum would have the decription:

              "Posts your code hack releases for version 2 in here. Please, no requests!"

              you already have the meta-keywords, by using the 'breadcrumb' of that forum.

              for example this forum would have the keywords:

              "vBulletin, Community, Forum, Customising, vBulletin, vBulletin, Code, Hacks, Releases"

              i know it's not perfect, but it's pretty damn close to all the information you want, and you could always add an override facility. generally though, we found at BT that meta tags are never maintained properly, but dynamically generating them takes into account when the forum is moved in the hierarchy, etc. or if you re-purpose a board, it just works out the new variables.

              again, just a suggestion that doesn't need to be listened to, but thought you'd like to know how other people do this stuff.

              cheers

              david k

              Comment

              • Jpp
                Member
                • May 2001
                • 37

                #8
                Installed it and it works perfect, But how can they make their first post if they cant get in to the forum, they can only view the board, Have i done something wrong or am I just stupid.

                Comment

                • mrlister
                  Senior Member
                  • Nov 2000
                  • 371

                  #9
                  Good Job! I love it!
                  - MrLister

                  Comment

                  • Wayne Luke
                    vBulletin Technical Support Lead
                    • Aug 2000
                    • 74092

                    #10
                    Originally posted by Jpp
                    Installed it and it works perfect, But how can they make their first post if they cant get in to the forum, they can only view the board, Have i done something wrong or am I just stupid.
                    They can post in other forums. That is handled on a forum by forum basis and the post counts are compared against the user's total.

                    The reason we do it is because we have an advertising forum where each member can post one ad a month. We made a requirement that they have to have 20 posts minimum so that they contribute to the community in a meaningful way (since posts in the general chat forum don't count) before they post their advertisement.
                    Translations provided by Google.

                    Wayne Luke
                    The Rabid Badger - a vBulletin Cloud demonstration site.
                    vBulletin 5 API

                    Comment

                    • Jpp
                      Member
                      • May 2001
                      • 37

                      #11
                      Ok that make sence, have to figure out how to use it on my board then. Btw very nice work. ;-)

                      Comment

                      • GMTalk
                        Senior Member
                        • Aug 2000
                        • 314

                        #12
                        Wayne....

                        This looks to be a great hack. I just ran into a slight problem on the install

                        I have followed the instructions and when i run the ff_install.php

                        I get to the following
                        Forum Features (version 1.2)
                        from Wayne Luke
                        Altering forum table
                        Installing necessary templates...


                        it just hangs there.

                        Does not go any further.

                        I have seen that it created the following in the forum table:


                        metakey char(250) Yes None NULL
                        metadesc char(250) Yes None NULL
                        robotext char(50) Yes None NULL
                        showactive smallint(5) No None 1
                        censor smallint(5) No None 1
                        minviewposts smallint(5) No None 0
                        minposts smallint(5) No None 0


                        No other information was entered that I can see in any of the tables.

                        Any thoughts. I have removed the above fields.

                        TIA

                        john

                        Comment

                        • Wayne Luke
                          vBulletin Technical Support Lead
                          • Aug 2000
                          • 74092

                          #13
                          It isn't hanging there.. It is done at that point.

                          To clarify, I add a phrase saying it was done at the end of the script.

                          The only table in the database that it touches is the forum table and those fields are the ones it adds. The install script also adds 2 new error templates to handle the minimum post requirements for new threads and viewing a forum.

                          You can change these options by modifying a particular forum.
                          Translations provided by Google.

                          Wayne Luke
                          The Rabid Badger - a vBulletin Cloud demonstration site.
                          vBulletin 5 API

                          Comment

                          • GMTalk
                            Senior Member
                            • Aug 2000
                            • 314

                            #14
                            WLuke,

                            I installed and now I get this when I try to add a subforum.


                            Database error in vBulletin Control Panel: Invalid SQL: 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,metakey,metadesc,robotext,
                            showactive,censor,minviewposts,minposts)
                            values (NULL,'1','testtesttest','',
                            '1','1','1','','1','1',
                            '30','','',
                            '0','0','1','0','1',
                            '1','0','1','1','0',
                            '','','',
                            1,1,,)
                            mysql error: You have an error in your SQL syntax near ')' at line 13
                            mysql error number: 1064
                            Date: Wednesday 06th of June 2001 10:31:10 PM
                            Script: /forum2/admin/forum.php
                            Referer: http://www.s-seriesforum.com/forum2/...add&parentid=1

                            Comment

                            • fastforward
                              Senior Member
                              • Nov 2000
                              • 1013

                              #15
                              You need to put single quotes around the $minviewposts and $minposts in the INSERT statement you edited in admin/forum.php. For some reason MySQL requires quotes for all datatypes except INT. Those two fields are SMALLINT.
                              http://britishexpats.com/ - British expatriate community

                              Comment

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