Results 1 to 7 of 7

Thread: [Release vb2.0] Exclude/Include Usergroups from Members List

Threaded View

  1. #1
    Senior Member bira is on a distinguished road bira's Avatar
    Join Date
    May 2000
    Location
    2nd turn left
    Age
    42
    Posts
    1,501

    [Release vb2.0] Exclude/Include Usergroups from Members List

    This one is for CJ:

    it allows you to select in a usergroup's settings whether the members of this usergroup will show up in the Members List.

    For example, on my Bulletin Board members of the "Banned Users" and "Users Awaiting Email Confirmation" are excluded and will not show up on the Members List.

    Others might find it useful if they want to exclude Administrators or other site personnel.

    In any case, it's a very simple hack (I think). It involves runnign one MySQL query and editing two scripts.

    Installation:

    1. Run the following MySQL command via phpMyAdmin or Telnet:

    Code:
    ALTER TABLE usergroup ADD showinlist SMALLINT (6) DEFAULT '1' not null
    (explanation: the above query will add a column to the usergroup table 'showinlist' with the default value being '1' so that by default, ALL usergroups are included in the Members List (like it is now)).

    2. Open admin/usergroup.php.

    Find:

    PHP Code:
    makeyesnocode("Can modify profile","canmodifyprofile",1); 
    BELOW it add:

    PHP Code:
    makeyesnocode("Appear in Members List","showinlist",1); 
    Find:

    Code:
    candenypmreceipts,maxbuddypm,maxforwardpm)
    REPLACE it with (change is in red):

    Code:
    candenypmreceipts,maxbuddypm,maxforwardpm,showinlist)
    Find:

    Code:
    $maxbuddypm,$maxforwardpm)
    REPLACE it with (change is in red):

    Code:
    $maxbuddypm,$maxforwardpm,$showinlist)
    Find:

    PHP Code:
    makeyesnocode("Can modify profile","canmodifyprofile",$usergroup[canmodifyprofile]); 
    BELOW it add:

    PHP Code:
    makeyesnocode("Appear in Members List","showinlist",$usergroup[showinlist]); 
    Find:

    Code:
    maxforwardpm=$maxforwardpm
    REPLACE it with (change is in red):

    Code:
    maxforwardpm=$maxforwardpm,showinlist=$showinlist
    Save the file.

    3. Open memberlist.php

    Find:

    PHP Code:
    $memberlistbit ""
    ABOVE it put:

    PHP Code:
      $showugroup=$DB_site->query("SELECT usergroupid FROM usergroup WHERE showinlist=0");
        while(
    $thisgroup=$DB_site->fetch_array($showugroup)) {
            
    $condition.=" AND usergroupid!='$thisgroup[usergroupid]'";
      } 
    Save and upload both files.


    Now, go to the Control Panel -> User Groups and Permissions -> Modify.

    Click on "edit" next to the usergroup you want to EXCLUDE from the Members List. (meaning: the members of that usergroup will not appear in the Members List).

    Under the "Miscellaneous Permissions" section you will find a yes/no option whether members of this usergroup will show up in the Members List or not.



    Cheers,

    Bira
     

  2. #2
    Senior Member bira is on a distinguished road bira's Avatar
    Join Date
    May 2000
    Location
    2nd turn left
    Age
    42
    Posts
    1,501
    One more thing.

    I did not include this in the hack as it wasn't directly the same however I thought I'd mention this:

    On my Bulletin Board, users with 0 posts are excluded from the members list as well.

    If you are interested in this too (not showing users who never posted), then also do the following in memberlist.php:

    Find TWICE:

    Code:
    WHERE $condition AND
    And REPLACE it with (change is marked in red):

    Code:
    WHERE $condition AND posts!='0' AND
    Cheers,

    Bira
     

  3. #3
    Senior Member wajones has disabled reputation wajones's Avatar
    Join Date
    Jul 2000
    Location
    Vista, California
    Age
    65
    Posts
    453
    This is great and on the lines of something I'm tying to achieve, but a little different. I want to have new members be able to join a particular group, show up in that groups membership list but not in other's. Sort of like having different lists for different groups but in actuallity everyone is in the same user table. Does that make any sense?
    Well would I do something simular to this to achieve that or am I off base.
     

  4. #4
    Senior Member bira is on a distinguished road bira's Avatar
    Join Date
    May 2000
    Location
    2nd turn left
    Age
    42
    Posts
    1,501
    wajones, this can be achieved quite easily:

    Open memberlist.php

    find:

    PHP Code:
        if ($postsupper!="") {
          
    $condition.=" AND posts<'$postsupper'";
        } 
    Below it add:

    PHP Code:
        if ($usergroup!="") {
          
    $condition.=" AND usergroupid='$usergroup'";
        } 
    Now, if you view the Members List via url memberlist.php?usergroup=xx

    you will see only the users in usergroup whose id is xx

    example:

    http://www.atlasf1.com/bb/memberlist.php?usergroup=6 -- you will see all the members of the Administrator usergroup.

    ***
    Now here's another twist you can add.

    If you want a logged in user to see only members of his group, do the following instead:

    PHP Code:
        if ($usergroup!="") {
          
    $condition.=" AND usergroupid='$usergroup'";
        } elseif (
    $bbuserinfo[usergroupid]!="") {
          
    $condition.=" AND usergroupid='$bbuserinfo[usergroupid]'";
        } 
    This means that a user viewing memberlist.php will see only members of his own usergroup listed. A user not logged in or unregistered will see ALL members (unless you excluded a certain group using the previously posted hack).
     

  5. #5
    Senior Member wajones has disabled reputation wajones's Avatar
    Join Date
    Jul 2000
    Location
    Vista, California
    Age
    65
    Posts
    453
    Great, Thank you very much!!!
     

  6. #6
    Senior Member bira is on a distinguished road bira's Avatar
    Join Date
    May 2000
    Location
    2nd turn left
    Age
    42
    Posts
    1,501
    One more option for those interested:

    If you want the "Registered Members: XXXX" on the BB's front page to NOT include those whom you excluded from the Members List (example: if you don't want Banned Users to be included in neither the Members List nor the total Members count), then do the following:

    Open index.php

    Find:

    Code:
    $numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
    And REPLACE with (changes marked in red):

    Code:
    $condition="1=1";
    $showugroup=$DB_site->query("SELECT usergroupid FROM usergroup WHERE showinlist=0");
      while($thisgroup=$DB_site->fetch_array($showugroup)) {
          $condition.=" AND usergroupid!='$thisgroup[usergroupid]'";
    }        
    $numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user WHERE $condition');
    Cheers,

    Bira
     

  7. #7
    New Member netphreak is on a distinguished road
    Join Date
    Apr 2001
    Age
    33
    Posts
    19
    Fatal error: Call to unsupported or undefined function ****while() in /home/sites/site25/web/bb/memberlist.php on line 90

    Is this a result of using non-supported functions by php3?

    Really, all I am looking for is a way to prevent (COPPA) Users to show up in the "Welcome to our newest user, XXXXX"

    And preferably a way to show (COPPA) Users on the index site, as links to their profiles.

    I tried to add this in the index.php:

    PHP Code:
    $getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max] AND usergroupid=2"); 
    where the code I added was "AND usergroupid=2"

    Shouldn't this work?

    -net
     

Similar Threads

  1. Exclude members of certain usergroups from the registered users-number?
    By kie in forum vBulletin 3.0 How Do I and Troubleshooting Forum
    Replies: 1
    Last Post: Sun 28th Dec '03, 1:57pm
  2. Usergroups with <> in title don't appear on usergroups' list
    By Martz in forum vBulletin 3.0 Fixes and Patches
    Replies: 1
    Last Post: Sun 15th Jun '03, 12:19pm
  3. members list doesn't include all members
    By mikehoover in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 4
    Last Post: Fri 15th Feb '02, 11:25am
  4. Add option not to include certain usergroup in Members List
    By bira in forum vBulletin 2 Suggestions and Feedback
    Replies: 3
    Last Post: Sun 18th Mar '01, 1:37pm

Bookmarks

Posting Permissions

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts