PDA

View Full Version : Members of usergroup listed in a module


joeychgo
09-03-2004, 02:31 PM
How do I do this? I using CMPS to make a page for a public group, and want to have the mebers of this group listed in a module. I can see the list via 'forum leaders' -- how do I get that list (just the names) into a module??

WAR
09-04-2004, 06:24 PM
I would like to see this to if that helps inspire anyone to look into doing it

Our Sponsors
 

joeychgo
09-04-2004, 11:24 PM
Me too!!!!

joeychgo
09-12-2004, 04:27 PM
Bump

Can anyone help please?

Our Sponsors
 

Milorad
09-13-2004, 04:35 AM
I'm on board for this myself, if anyone can help.

I would like to show my authors (who are members of a special group) on my v3 articles page.

joeychgo
09-16-2004, 03:18 AM
IM amazed nobody is stepping up on this one.

Brian
09-16-2004, 03:47 AM
PHP file:


<?php
$users = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE usergroupid = 'X'");
while ($user = $DB_site->fetch_array($users))
{
$userbits .= '<a href="' . $vboptions['bburl'] . '/member.php?u=' . $user['userid'] . '">' . stripslashes($user['username']) . '</a><br />';
}

eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_usergroup') . '";');
?>


(Replace X in the query with the usergroup id)

New template called 'adv_portal_usergroup':


<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat"><span class="smallfont"><strong>$vba_options[portal_blockbullet] <!-- Module Title Here --></strong></span></td>
</tr>
<tr>
<td class="$getbgrow" width="100%">

$userbits

</td>
</tr>
</table>
<br />

joeychgo
09-16-2004, 05:12 AM
what do I do with the .PHP file part???

Diver
09-16-2004, 05:35 AM
use it as a new module file i guess

Brian
09-16-2004, 11:51 AM
Create a file called whatever.php, upload it to your modules folder, then add a new module and select that file as the file to include.

Regs
09-16-2004, 12:53 PM
Hi Brian,

I'm just getting the php code printing out in plain text at the top of the page I'm trying to include this module in... I've checked everything 3 times with no luck (and yes, I've changed the X to an existing usergroup ID :D )

Is there something missing?

Cheers,

~Regs.

Brian
09-16-2004, 01:14 PM
Did you add the PHP code into a file and upload that file to your forum/modules directory?

joeychgo
09-16-2004, 01:43 PM
Parse error: parse error, unexpected T_VARIABLE in /home/lincol14/public_html/modules/UsergroupList.php on line 8

Brian
09-16-2004, 01:47 PM
Whoops... Maybe I should test code before posting it late at night. Try now. :)

joeychgo
09-16-2004, 02:10 PM
not giving me anything in the block ----??

http://www.lincolnvscadillac.com/index.php?page=Midwest

Regs
09-16-2004, 02:12 PM
Well, at least we're getting somewhere now :D

However, I'm only getting one user showing up in the list rather than every user belonging to the usergroup ID I've specified... I've tried other usergroups with the same result (one member belonging to that group but know others).

Thanks for the help, much appreciated!

~Regs.

Brian
09-16-2004, 02:16 PM
Change $userbits = to $userbits .= and that should fix the probelm.

Joey - Can you post what you used for the options when you added the module?

Regs
09-16-2004, 02:19 PM
I've solved this on my own which is quite the feat considering my limited knowledge of PHP :D

In the PHP code block Brian gave, change this bit

$userbits = '<a href="' . $vboptions['bburl'] . '/member.php?u=' . $user['userid'] . '">' . stripslashes($user['username']) . '</a><br />';

to this

$userbits .= '<a href="' . $vboptions['bburl'] . '/member.php?u=' . $user['userid'] . '">' . stripslashes($user['username']) . '</a><br />';

just changed the = to .=

Cheers,

~Regs.

Regs
09-16-2004, 02:19 PM
Looks like I need to work on my typing skills/speed as well as PHP :D

Thanks again Brian!

~Regs.

joeychgo
09-16-2004, 02:23 PM
when I let the module be active, im getting all kinds of db errors ---


Edit - might be a problem on the server -

Brian
09-16-2004, 02:35 PM
Can you post what you have for the php code in the module?

joeychgo
09-16-2004, 02:36 PM
The module comes up with no data in it........

Options are normal options, left column, usergrouplist.php, tmplate used usergroup

<?php
$users = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE usergroupid = '16'");
while ($user = $DB_site->fetch_array($users))
{
$userbits = '<a href="' . $vboptions['bburl'] . '/member.php?u=' . $user['userid'] . '">' . stripslashes($user['username']) . '</a><br />';
}

eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_usergroup') . '";');
?>

Brian
09-16-2004, 02:38 PM
The query looks right... What was the db error you were getting?

joeychgo
09-16-2004, 02:39 PM
when I let the module be active, im getting all kinds of db errors ---


Edit - might be a problem on the server -



The server was being rebooted...........

joeychgo
09-16-2004, 02:40 PM
The query looks right... What was the db error you were getting?



I was getting various db errors, no one place.....It has to do with the server being rebooted I think

Brian
09-16-2004, 02:41 PM
Ahh... Not sure what the problem would be then. If you want to submit a support ticket though I'll be glad to take a look.

joeychgo
09-16-2004, 02:45 PM
no the host said they rebooted the server.......... lets assume its them..


The module isnt displaying any Info:

http://www.lincolnvscadillac.com/index.php?page=Midwest

Top Left

58sniper
09-16-2004, 03:52 PM
no the host said they rebooted the server.......... lets assume its them..


The module isnt displaying any Info:

http://www.lincolnvscadillac.com/index.php?page=Midwest

Top Left
I've got the same problem. Module shows up, but it's empty.

joeychgo
09-19-2004, 02:26 AM
Bump

Brian
09-19-2004, 12:48 PM
Ahh... Not sure what the problem would be then. If you want to submit a support ticket though I'll be glad to take a look..

attroll
03-22-2005, 03:10 AM
I've got the same problem. Module shows up, but it's empty.

The reason it is showing up empty is because inside you PHP file you need to change 'adv_portal_usergroup' to what the name of the template is that you are using.

attroll
03-22-2005, 12:24 PM
I got this working and it works awesome. But I was wondering if there was a way of listing a users group that that had Additional users in it. What I mean for example is the users that are Registered but are also listed in another group as Additional Members?

CallieJo
04-15-2005, 08:50 PM
Is it possible to display more than one usergroup like so:

Admins
Mods
SuperMods
Custum Usergroup name

?

Thanks a bunches and have a splendid day ;-)

Vevina
04-16-2005, 04:30 PM
Is it possible to display more than one usergroup like so:

Admins
Mods
SuperMods
Custum Usergroup name

?

Thanks a bunches and have a splendid day ;-)

i would like this too :)

Tee
06-08-2005, 07:15 PM
I have been trying to get this module to work since yesterday but have had no luck. Can someone tell me what I am doing wrong. Below are the step I took

1) I created a file called 'enlistedonline.php' and copied and pasted the code below into it
<?php
$users = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE usergroupid = 'X'");
while ($user = $DB_site->fetch_array($users))
{
$userbits .= '<a href="' . $vboptions['bburl'] . '/member.php?u=' . $user['userid'] . '">' . stripslashes($user['username']) . '</a><br />';
}

eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_usergroup') . '";');
?>

Changed the 'X' to '9'

2) I placed it in my modules directory

3) in the admin panel i went to
-styles and template
-style manager
-all style options
-add new templates and created a file 'adv_portal_usergroup'.

I pasted the below code into the file:

<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat"><span class="smallfont"><strong>$vba_options[portal_blockbullet] <!-- Module Title Here --></strong></span></td>
</tr>
<tr>
<td class="$getbgrow" width="100%">

$userbits

</td>
</tr>
</table>
<br />

4) I went to
-vBa CMPS
-Add Modules
-PHP File

5) Set the following options:
Title - Enlisted Online
Column - Left
Display Order - 9
Active - Yes
Update all pages - No
File to include - enlistedonline.php
Module Parent - none
Identifier - enlisted (i could not leave it blank)
Templates Used - blank
Clean File output - No

Use Module Shell Template - Yes
Module Link - tried both 'adv_portal_usergroup' and
'usegroup'
Title Row Colspan - blank
Form Code - blank
usergroup options - all are set to yes for now

I am new to php and vbulletin. I copied and pasted the code exactly as is and did not add anything else so if there are other steps that the average coder would know to do, I left them out. Is there anything else I was supposed to add or do? Any help will be appreciated.

mholtum
06-08-2005, 08:11 PM
PHP file:


<?php
$users = $DB_site->query("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE usergroupid = 'X'");
while ($user = $DB_site->fetch_array($users))
{
$userbits .= '<a href="' . $vboptions['bburl'] . '/member.php?u=' . $user['userid'] . '">' . stripslashes($user['username']) . '</a><br />';
}

eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_usergroup') . '";');
?>


(Replace X in the query with the usergroup id)

New template called 'adv_portal_usergroup':


<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat"><span class="smallfont"><strong>$vba_options[portal_blockbullet] <!-- Module Title Here --></strong></span></td>
</tr>
<tr>
<td class="$getbgrow" width="100%">

$userbits

</td>
</tr>
</table>
<br />
What would need to be added to say only display 10 random users from a certain group?

mholtum
06-20-2005, 03:37 AM
-bump-

mholtum
06-24-2005, 06:21 PM
Bump