Hoping you can help with two things I'd like to achieve.

1. I am using custom user profiles and am using the following code to show which groups a user is a member of. What I need is to also display their role next to the membership, i.e. Leader or Mermber. Can you help with the code required for this?

<h2>Taskforce Membership</h2>
<div class="item-list"><ul>
<?php
$groups = $user->og_groups;
if($groups){
    foreach($groups as $group){
    echo "<li>";
        print l($group[title], 'node/'.$group[nid]);
    echo "</li>";
    }
}
else {
        echo "<li>$user->name is not a member of a Taskforce</li>";
}
?>
</ul>

2. I would like to display the members and admins on each group homepage with links off to their user profiles. I have tried the teampage module, but this is not exactly what I need.

Thank you in advance
Scott Gavin

Comments

moshe weitzman@drupal.org’s picture

Status: Active » Fixed

1) looks good

2) you can copy code from the list tab on the subscribers page. see the link in each block (if you are a group admin or sitewide admin).

gavin_s’s picture

Hi Moshe - thanks for the reply, can you just indicate how I display role next to the group membership on the profile page? I need more code to go into my sippet you see.

Thanks, Scott

gavin_s’s picture

Also, for 2) how exactly can I copy the code??? View source? Not much in there to copy that I can see. Cheers

moshe weitzman’s picture

well, if you mean group role then that info is in $group['is_admin']. there are only regular users and admins in groups right now. if you mean regular drupal role then see $user->roles.

Anonymous’s picture

Status: Fixed » Closed (fixed)