Call up groups.

Is there a code where it shows a list of people who are in a group?

Thanks,

Jack.

$users = UserGroups::GetUsersInGroup ([group id);

Replace [group id] with the ID of the group, and it will return an array of all the users in it

This hasn’t called anything back.

What do you mean?

I have placed this onto the page:

<?php $users=UserGroups::GetUsersInGroup (16); ?>

and people are in the group, when I view the page it’s just blank.

Well, you have to do something with it:

// After that


foreach($users as $pilot)
{
    echo "The pilot is {$pilot->firstname} {$pilot->lastname}<br />";
}
<table width="940" border="0" align="center" cellpadding="1" cellspacing="0" style="background-color:white;border:1px dashed black;">
  <tr>
    <td><div align="center">On completion of this Operation, all crew members stated below will be able to place the "<strong>Operation Herrick 11</strong>" medal on there Forum Signatures.</div></td>
  </tr>
</table>
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="470"><h2>Alpha Crew</h2>
    <?php $users = UserGroups::GetUsersInGroup (16);?>
<?php foreach($users as $pilot)
{
    echo "The pilot is {$pilot->firstname} {$pilot->lastname}";
} ?></td><td><h2>Bravo Crew</h2></td>
  </tr>
</table>

This is the coding on the page and it is bringing back

Warning: Invalid argument supplied for foreach() in /####/####/public_html/core/pages/operation######.htm on line 10

.

If anyone can help 

Then either the group ID is wrong or there’s no users in the group

You can do:

if(!$users) { echo 'There are no pilots in this group'; $users=array(); }
// Before this line
foreach($users as $pilot)

Ok cheers, for some reason it is just saying nobody is in the group. But there is.

This is odd. The API docs say the function is there, but I don’t see it in the code. Let me check this out, sorry about that!

Not a problem, once we find the problem the better  ;D

Is anybody able to get this to work?

Hey, track it here, I’ll get to it soon, sorry:

http://bugs.phpvms.net/ticket/101

This will work from the next beta,

$list_of_pilots = PilotGroups::getUsersInGroup($group_name_or_id);