SSI MemberGroup

Started by SleePy, November 07, 2006, 10:48:21 AM

Previous topic - Next topic

SleePy

Link to Mod
Rate this Mod

This Mod Adds to your SSI.php a function that allows you to get all members from a membergroup. This is great for people who run Clan, Guild sites or just need a roster of members..
This was Created to Search Regular Groups and Not Post based Groups.

Features:
  + Get Users From a Membergroup
  + Search Additional Groups..
  + Search and Array of Groups (IE Search Groups 1 and 2 at once)
  + Sort by ID_MEMBER or realname
  + Sort by Ascending (ASC) or Descending (DESC)
  + output echo or into an array for customization..
  + ID and class tags set to allow CSS style sheets to customize easily.

Usage:
ssi_membergroup($groupid = 1, $additional = 0, $sort = 1, $sortorder = 1, $output_method = 'echo')

Additional:
      0 = Do Not Search (Default)
      1 = Search Additional

Sort:
      1 = Sort by realname  (Default)
      2 = Sort by ID_Member

Sortorder:
      1 = Sort by ASC  (Default)
      2 = Sort by DESC

Oputput:
Leave blank Unless you are wanting to output as an array.
if so the following 2 values are used in the array:  id, name
foreach is best used..



Notes:
Group ID 0 Can not be selected, It will default to 1 (admins)..

Examples:

ssi_membergroup(2, 1);


$groups = array (1,2);
ssi_membergroup($groups, 1);


$groups = array (1,2);
$mygroup = ssi_membergroup($groups, 1, 1, 1, 'array');
foreach($mygroup as $mem)
echo '<a href="'.$scripturl.'?action=profile;u='.$mem['id'].'" class="ssi_membergroup" id="ssi_member_'.$mem['id'].'">'.$mem['name'].'</a><br/>';
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

littleone

I might be a bit confused but what is the difference between this mod and VBGamers Staff Page Mod?  The only difference I see is appearance.  Could you Please Specify in more details the benefits of this mod?

Thanks

SleePy

This mod is nothing like the Staff Page mod..

You use it with SSI to grab members from groups and display them. Such as Rosters or Staff page to display on a page.
Such as on my site I use it all over and have multiple rosters and such getting users from groups and showing them to my viewers.
Makes it very easy to update my rosters by just adding somebody to that membergroup and its updated.

So You choose which groups you want to get members from and how you want it to order them and such then make it look how you want it to look...

The example picture is just an example of how it can be used.. Hopefully the picture didn't throw you off and think it was a copy of the Staff Page mod. It was just one of my examples. I could add another Screenshot of another way I did a roster if that is helpful.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

littleone

I just think the whole SSI thing confuses me thats all.  I know there are a couple of different mods involving it but I just dont understand it.  I tried reading up on it today.  Maybe its because I dont have a use for it so I never bothered to use it.  I appreciate you trying to explain it and clearing it up that it wasnt the same as the staff page mod ;)

Xarcell

This is really a nice mod.

Thanx...

Adamzon

i dont understand, Where is the text
"ssi_membergroup(2, 1);  be put in? and where can i access the page?

More info should make this mod the exact thing i need

denislici

Quote from: SleePy on November 07, 2006, 06:01:43 PM
Makes it very easy to update my rosters by just adding somebody to that membergroup and its updated.

the Staff Page mod does the same thing...
Love the Creature for Creator's sake. (English)
Duje Krijesen per hire te Krijuesit. (Albanian)
Yaradılan'ı sev Yaradan'dan ötürü. (Turkish)
Ami la Creatura per ce la creato il Creatore. (Italian)

SleePy

This Mod is to be used SSI to use..
Please read [README] SSI FAQ's for more information on how to use SSI..
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

denislici


yes i got it uses SSI but i said that its featuries are the same with Staff Page mod....
Love the Creature for Creator's sake. (English)
Duje Krijesen per hire te Krijuesit. (Albanian)
Yaradılan'ı sev Yaradan'dan ötürü. (Turkish)
Ami la Creatura per ce la creato il Creatore. (Italian)

Adamzon

Still dont get it, I makes my site to crash

Adamzon

Can anyone make a "How to" ?


SleePy

A very basic way is to create a php page and do this:


<?php
require_once('/path/to/forum/SSI.php');

ssi_membergroup(2, 1);
?>


Which would output all people who are Global Moderators..

My mod is intended for people who wish to customize a php page to display their membergroups..

an advance way could be a page like I have on my site that displays my Master Roster.

Note: I didn't comment any of my code. I don't comment code I don't intend to release to people. Since I know what I am talking about in my coding..  :D

<?php
require_once('/path/to/forum/SSI.php');
$groups = array (
1 => array (
'name' => 'NwG',
'output' => ssi_membergroup(array(22,27,14),1,1,1,"array"),
),
2 => array (
'name' => 'NbS',
'output' => ssi_membergroup(array(92,91),1,1,1,"array"),
),
3 => array (
'name' => 'RoKs',
'output' => ssi_membergroup(62,1,1,1,"array"),
),
4 => array (
'name' => 'WTF',
'output' => ssi_membergroup(array(57,15),1,1,1,"array"),
),
5 => array (
'name' => 'KaG Community - All Girls',
'output' => ssi_membergroup(array(11,56),1,1,1,"array"),
),
6 => array (
'name' => 'Tribal',
'output' => ssi_membergroup(16, 1,1,1,"array"),
),
);


echo '<table border="0" cellspacing="0" cellpadding="2" width="100%">';
echo '<tr  class="windowbg2" >';
echo '<td class="titlebg" colspan="'.count($groups).'" align="center" style="font-size:200%;">LcT Tribe Master Roster</td></tr>';

echo '<tr>';
$a = 0;
foreach($groups as $group)
{
echo '<td class="windowbg2" valign="top"><table  border="0" cellspacing="0" cellpadding="2" width="100%">';
echo '<tr><td class="catbg2" width="30%" colspan="4">'.$group['name'].'</td></tr>';

foreach ($group['output'] as $info)
                     {
$a++;
echo '<td class="windowbg"><a href="'.$scripturl.'/action,profile/u,'.$info['id'].'.LcT">'.$info['name'].'</a></td>';
if($a==4)
echo '</tr><tr>'; $a = 0;
                      }
if($a==1)
{ echo '<td class="windowbg"></td>'; $a++;}
if($a==2)
{ echo '<td class="windowbg"></td>'; $a++;}
if($a==3)
{ echo '<td class="windowbg"></td>'; $a++;}
if($a==4)
{ echo '</tr><tr>'; $a= 0;}

echo '</table></td></tr><tr>';
}
?>


So basically your code can be as simple as can be or as advance as you need it..

Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Adamzon

Some things cleard up :) Thanx

/Adam

benjeewest

Hi, congrats on making a really useful mod. One question- is there any way of having the mod display the group name above the list of members? Thanks.

SleePy

Quote from: benjeewest on January 01, 2007, 11:50:00 AM
Hi, congrats on making a really useful mod. One question- is there any way of having the mod display the group name above the list of members? Thanks.

At this time and point I have not added that option. Though It could be done by making a quick database query to find it.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Saku

I have a group with 0 members
I choose to be part of this group as an additionnel group, should I be listed or nothing will be displayed for this group?

SleePy

as the read me shows:
ssi_membergroup($groupid = 1, $additional = 0, $sort = 1, $sortorder = 1, $output_method = 'echo')

If you use aditional as 1. IE: ssi_membergroup(4, 1);
It will search all people in group 4 even the additional group.
So you can have it or not.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Saku

sorry but it return nothing,
I don't understand how did you get the additionalGroups from members table??


$request = db_query("
SELECT ID_MEMBER, realname, ID_GROUP
FROM {$db_prefix}members
WHERE ID_GROUP IN (" . implode(', ',$groupid) . ")".$additional."
ORDER BY '".($sort == 2 ? 'ID_MEMBER' : 'realname')."' ".($sortorder == 2 ? 'DESC' : 'ASC')."", __FILE__, __LINE__);

SleePy

Go back and look where $additional is setup just above that. That is what sets up the additional. But you don't  have to do anything as the script should configure it for you.

It only does it that way if $groupid is an array. Otherwise it does it the other way.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Saku

ok I'll try to explain you my problem (my english is not good)
I have a group (id=30) with 0 members
I choose to be part of this group as an additionnel group, my primary group id=1
but this function doesn't return any result
ssi_membergroup(30, 1);

Advertisement: