Welcome, Guest. Please Login or Register.
May 14, 2025, 10:36:38 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Memberlist Membergroups only « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Memberlist Membergroups only  (Read 1244 times)
Valconeye
Full Member
***
Posts: 190


Memberlist Membergroups only
« on: August 29, 2003, 04:04:47 AM »
Reply with quote

have like action=mlgroup1 where group1 is a membergroup. and it would list only them members in that current membergroup.
Logged
Shadow's Pawn
Support Team
YaBB God
*****
Posts: 597


ich soll nicht toten

ICQ - 8039201shadowpawn@hotmail.com WWW
Re:Memberlist Membergroups only
« Reply #1 on: August 29, 2003, 04:37:51 AM »
Reply with quote

This would be really easy.. in fact, you can just copy the old MLMemgrp function and then edit the query info to add WHERE memberGroup = "whatever membergroup" as a condition for what members it should list..

I'm not sure right off hand without looking at memberlist.php but there are probably only a couple queries in that to edit.  Then just rename the new function to something like MLMemgrp1 and add it to the links.

I can probably post some code if you need it.
Logged

apologize \A*pol"o*gize\, v. i. - To lay the foundation for a future offense.
Valconeye
Full Member
***
Posts: 190


Re:Memberlist Membergroups only
« Reply #2 on: August 29, 2003, 06:54:24 AM »
Reply with quote

if you could post some code that would be great! im not that good with php, but ill take a look at it and see what i come up with, and post what i get done, then we can compare.
Logged
Valconeye
Full Member
***
Posts: 190


Re:Memberlist Membergroups only
« Reply #3 on: August 29, 2003, 08:08:35 AM »
Reply with quote

i was thinking of instead of having to edt the memberlist.php everytime i want to add a new membergroup, have something like action=mlmemgrp&<? $grp ?> where $grp = membergroupname , i hope i can figure this out :)
Logged
Shadow's Pawn
Support Team
YaBB God
*****
Posts: 597


ich soll nicht toten

ICQ - 8039201shadowpawn@hotmail.com WWW
Re:Memberlist Membergroups only
« Reply #4 on: August 29, 2003, 01:46:35 PM »
Reply with quote

I'll post some later tonight when I get home from work.

If you do follow my suggestion, just make sure you add the new function to index.php.. somewhere around this area

      'mlall' => array("$sourcedir/Memberlist.php", 'MLAll'),
      'mlmemgrp' => array("$sourcedir/Memberlist.php", 'MLMemgrp'),

or it won't work.
Logged

apologize \A*pol"o*gize\, v. i. - To lay the foundation for a future offense.
Valconeye
Full Member
***
Posts: 190


Re:Memberlist Membergroups only
« Reply #5 on: August 29, 2003, 05:57:34 PM »
Reply with quote

i added WHERE memberGroup = '$grp'") but i can get it to work, and the command mlgrp&grp=<$grp?> (lol no clue if this is right) yeah im bad at php
Logged
Valconeye
Full Member
***
Posts: 190


Re:Memberlist Membergroups only
« Reply #6 on: September 03, 2003, 01:38:52 AM »
Reply with quote

any luck? i have had none  :P
Logged
Shadow's Pawn
Support Team
YaBB God
*****
Posts: 597


ich soll nicht toten

ICQ - 8039201shadowpawn@hotmail.com WWW
Re:Memberlist Membergroups only
« Reply #7 on: September 03, 2003, 10:38:37 PM »
Reply with quote

Sorry, I've been busy.  What are the member group names that you want to display?  Anyway, here is a really quick way to do it, simply by copying the mlmgrp function.  Keep in mind that this is just quick and dirty.  All I did was insert a few things in a few spots to make it search for Administrators instead of all memberGroups.  Insert whatever membergroup you want to use where it says Administrator.

This is in Memberlist.php



function MLMemgrp1 ()
{
   global $user, $txt, $start, $MembersPerPage, $settings, $allow_hide_email, $color, $TableHeader, $MOST_POSTS;
   global $imagesdir, $cgi, $TableFooter, $db_prefix;
   global $NUM_MEMBERS, $yytitle;

   if ($MOST_POSTS == 0)
      $MOST_POSTS = 1;

   if ($user == 'Guest')
      fatal_error($txt[223]);

   // Get the number of members
   $result = mysql_query ("SELECT COUNT(*) FROM {$db_prefix}members WHERE memberGroup = 'Administrator'") or database_error(__FILE__, __LINE__);
   $row = mysql_fetch_row($result);
   $memcount = $row[0];
   
   if ($start == '')
      $start = 0;

   $numbegin = $start + 1;
   $numend = ($start + $MembersPerPage);
   if ($numend > $memcount)
      $numend = $memcount;

   $yytitle = "$txt[308] $numbegin $txt[311] $numend";
   template_header();

   echo '
      <table border="0" cellspacing="0" cellpadding="3" align="center" width="100%">
         <tr>
            <td bgcolor="' . $color['titlebg'] . '" align="center" class="titlebg">
               <font size="2" class="text1" color="' . $color['titletext'] . '"><b>' . $txt[308] . ' ' . $numbegin . ' ' . $txt[311] . ' ' . $numend . ' (' . $txt[309] . ' ' . $NUM_MEMBERS . ' ' . $txt[310] . ')</b></font>
            </td>
         </tr>
      </table>';

   echo $TableHeader;

   $membergroup = $row['memberGroup'];
   $mg_request = mysql_query("SELECT membergroup FROM {$db_prefix}membergroups ORDER BY ID_GROUP") or database_error(__FILE__, __LINE__); //query membergroups descriptions
   $membergroups = array();
   while ($mg_row = mysql_fetch_row($mg_request)) //retrieve all membergroups descriptions
      $membergroups[] = $mg_row[0];

   $query = "
      SELECT memberName,realName,websiteTitle,websiteUrl,posts,IF(memberGroup='Administrator','$membergroups[0]',IF(memberGroup='Global Moderator','$membergroups[7]',memberGroup)) AS theMemberGroup,ICQ,YIM,AIM,MSN,emailAddress,hideEmail,IF(memberGroup<>'',1,0) AS belongsToMembergroup, ID_MEMBER
      FROM {$db_prefix}members
      WHERE memberGroup='Administrator'
      ORDER by realName";
   printMemberListRows($query, true);

   echo $TableFooter;

   echo '
      <table border="0" width="100%" cellpadding="0" cellspacing="0">
         <tr>
            <td>
               <font size="2">
                  <b>' . $txt[139] . ':</b>';
   $c = 0;
   while (($c*$MembersPerPage) < $NUM_MEMBERS)
   {
      $viewc = $c + 1;
      $strt = $c * $MembersPerPage;
      if ($start == $strt)
         echo " $viewc";
      else
         echo " <a href=\"$cgi;action=mlmemgrp1;start=$strt\">$viewc</a>";
      $c++;
   }
   echo '
               </font>
            </td>
         </tr>
      </table>';

   footer();
   obExit();
}


Then in index.php look for

      'mlmemgrp' => array("$sourcedir/Memberlist.php", 'MLMemgrp'),


and add this afterwards

      'mlmemgrp1' => array("$sourcedir/Memberlist.php", 'MLMemgrp1'),


Then, going back to Memberlist.php, if you want to add the link to this in the memberlist, you need to find

if ($action == 'mlmemgrp')
   $Sort .= "$txt[yse288] | ";
else
   $Sort .= "<a href=\"$cgi;action=mlmemgrp\"><font size=\"2\" class=\"text1\" color=\"$color[titletext]\">$txt[yse288]</font></a> | ";


add this right after that

if ($action == 'mlmemgrp')
   $Sort .= "$txt[yse288] | ";
else
   $Sort .= "<a href=\"$cgi;action=mlmemgrp1\"><font size=\"2\" class=\"text1\" color=\"$color[titletext]\">$txt[yse288]</font></a> | ";


Keep in mind that in that last block of code, you will need to change the $txt[yse288] to something else, because you are going to need to go into english.lng and add in a new $txt to read 'Display Membergroup' where membergroup is whatever membergroup you are making the function display.

Also, if you look over what changes I made to mlmgrp, you'll see how to add this function for other membergroups.

Hope that helps.
« Last Edit: September 03, 2003, 10:40:22 PM by Shadow's Pawn » Logged

apologize \A*pol"o*gize\, v. i. - To lay the foundation for a future offense.
Valconeye
Full Member
***
Posts: 190


Re:Memberlist Membergroups only
« Reply #8 on: September 04, 2003, 06:31:07 AM »
Reply with quote

yeah it works, although is there anyway to make that Administrator be a typed in value, cause i do have alot of membergroups.
Logged
Metho
Sr. Member
****
Posts: 342


I'm a llama!

Re:Memberlist Membergroups only
« Reply #9 on: September 04, 2003, 06:49:56 AM »
Reply with quote

Yeah. You'd just have your input box name="requestgroup" value="' . $requestgroup .'" and in those where statements (i.e. WHERE memberGroup = 'Administrator'") you'd have it WHERE memberGroup = $requestgroup. Also would have to global $requestgroup...and probably mess around a bit more. I only looked at the code for 2 seconds or so. :P

Methonis
Logged

Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Memberlist Membergroups only « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.093 seconds with 20 queries.