No announcement yet.

Restricting new users...

  • Filter
  • Time
  • Show
Clear All
new posts

  • Restricting new users...

    From one of my forum guides...
    I know this has been raised before, but the new, improved software would seem to make it easier.

    How about a 'New Member' tier - maybe up to, say, 10-12 posts - where their user rights are restricted.

    For example, they cannot start new threads - quite a few duplicate threads seem to start that way as people jump straight in without looking first.

    Just a thought.
    Is this possible? Or does this demand a hack? Or... ?

  • #2
    given that forum permissions are handled at the group level...

    currently i don't believe there is any way to automatically promote a user to a new group based on their post count. actually, i don't believe there is any way to *automatically* change users' groups at all. it must be done manually.

    the easiest way for you to do what you want would be to set up new member moderation. Admin CP -> Options -> Change Options -> [User and registration options] -> Moderate New Members -> Yes. i think this will put new registrations into the (COPPA) Users Awaiting Moderation user group. you can then specify the permissions of that group under Admin CP -> User Groups and Permissions -> Modify -> (COPPA) Users Awaiting Moderation -> [edit].

    then periodically you can go to Admin CP -> Users -> Find, where "and usergroup is" = (COPPA) Users Awaiting Moderation, and "and Number of Posts is greater than" = 12 . this will pull up a list off everyone that meets that criteria and you can then assign each person in the list to the "registered" group which has normal posting permissions by default.

    ...the above is assuming that moderated members get put into the (COPPA) Users Awaiting Moderation user group. if they get put into a different group just change the above directions accordingly.


    • #3
      I wrote a little 'hack' that does this... You create a new user group, let's call it "before12", I did. You restrict them to only posting in others threads and in their own(Since they cannot post their own threads, replying in their own is kind of silly, but somebody must've stayed up too late as the reply code checks if you can reply to your own thread, if not, then you get sent a permissions error). Then you add this code to register.php

        if ($allowchangestyles==1) {
          $newstylefield = "styleid,";
          $newstyleval = "'".intval($newstyleset)."',";
        } else {
          $newstylefield = "";
          $newstyleval = "";
        $usergroupid = $DB_site->query_first("SELECT usergroupid FROM usergroup WHERE title='before12'");
        $newusergroupid = $usergroupid["usergroupid"];
        $DB_site->query("INSERT INTO user (userid,username,password,email,".$newstylefield."parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invisible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts,startofweek,ipaddress,pmpopup,referrerid,nosessionhash) VALUES (NULL,'".addslashes(htmlspecialchars($username))."','".addslashes($password)."','".addslashes(htmlspecialchars($email))."',".$newstyleval."'".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','".time()."','$cookieuser','".addslashes($prunedays)."','".time()."','".time()."','$newusergroupid','".addslashes($timezoneoffset)."','$emailnotification','$receivepm','$emailonpm','$options','".addslashes($birthday)."','".addslashes($umaxposts)."','".addslashes($startofweek)."','".addslashes($ipaddress)."','$pmpopup','".addslashes($testreferrerid['userid'])."','$nosessionhash')");
        // insert custom user fields
      and add this code to newreply.php

            if ($bbuserinfo[userid]!=0)
              if ($bbuserinfo[customtitle]==0 && $foruminfo[countposts])
                $usergroup=$DB_site->query_first("SELECT usertitle FROM usergroup WHERE usergroupid='$bbuserinfo[usergroupid]'");
                if ($usergroup[usertitle]=="") {
                  $gettitle=$DB_site->query_first("SELECT title FROM usertitle WHERE minposts<=$bbuserinfo[posts]".iif ($foruminfo['countposts'],"+1","")." ORDER BY minposts DESC LIMIT 1");
                } else {
                if($bbuserinfo["posts"] < 12 && (($bbuserinfo["posts"]+1)) == 12)
                	$usergroupid = 2; //registered
                	$usertitle = $gettitle["title"];
                } else {
                	$usergroupid = $bbuserinfo["usergroupid"];
                $DB_site->query("UPDATE user SET
                ".iif ($foruminfo[countposts],"posts=posts+1,","")."
                $dotitle"."lastpost='".time()."',usergroupid=$usergroupid WHERE userid='$bbuserinfo[userid]'");
            // send email to moderators
            if ($enableemail) {
      Note: Only add the code in bold.

      Another note:
      Please make sure the files you are modifying are backed up, so if the hack doesn't work, you can just replace the files.
      I tested and successfully used this hack on vB 2.02 the version shouldn't really affect the hack, but I am not absolutely sure.
      I have not thouroughly tested this, and I take no responsibility of what happens if you install this.

      You should be able to figure out some ways to make this code a little bit more integrated into the admin control panel, but that would require a little bit more work...


      PS: Sorry for not adding line breaks to the code, but it would just get more confusing that way.
      Visual Basic, HTML, PHP, SQL, ASP, JavaScript, C++, Perl

      PHP 4.0.6
      MySQL 3.23.39
      Windows 2000


      • #4
        Thanks for the inspiration - but an easier hack (which involves adding just one set of code and a new template)...

        1. Edit newthread.php to add the code in bold...

        if ($foruminfo[allowposting]==0) {

        if($bbuserinfo["posts"] < 10)

        2. Go to your control panel and choose "Templates: Add"
        Template name: error_forumnewbie
        Template set: your standard set (Default)
        Template: "Thanks for trying to post a new message.<P>
        Until you've taken part in a few discussions, you can only reply, not post a new topic. Try searching for what you were going to post about, using the "Search" facility, and see if you can add your comment to something there."

        3. Upload newthread.php

        This will create a standard UBB error if you try to create a new topic and you've posted less than ten messages. (Change the "10" in the code snippet above to change the number of messages needed to be able to post new threads).

        I'm going to copy this hack into the hacks area, for my documentation purposes.


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