Try this to add Groups to a user's public profile. It works for me:
Create a new plug in:
Product: GRPS: Groups Commune
Hook Location: member_complete
Title: GRPS: List Groups In User Profile
Execution Order: 5
Plugin PHP Code:
Code:
// ###################### extracts my groups groups for main grps page
//require_once("./includes/functions_grps.php");
$grps_ids = explode(' ', trim($userinfo['grps']));
$baselocation = ($vbulletin->options['grps_locationswitch'] == TRUE) ? $vbulletin->options['homeurl'] : $vbulletin->options['bburl'];
if (!empty($userinfo['grps']))
{
$grps_ids_imploded = implode(",", $grps_ids);
$grps_mygroups = $db->query("
SELECT grps.groupid, grps.title, grps.description, grps.approved, grps.leaderid, grps_setting.image_name, MAX(grps_thread.lastpostdateline) AS dateline
FROM grps
LEFT JOIN grps_setting ON (grps_setting.groupid = grps.groupid)
LEFT JOIN grps_thread ON (grps_thread.groupid = grps.groupid)
LEFT JOIN " . TABLE_PREFIX . "user AS " . TABLE_PREFIX . "user ON (" . TABLE_PREFIX . "user.userid = grps.leaderid)
WHERE grps.approved = '1' AND grps.groupid IN($grps_ids_imploded)
GROUP BY grps.groupid
ORDER BY dateline DESC
LIMIT 15
");
$mygroups = "<ul>";
while ($grps_mygroupsinfo = $db->fetch_array($grps_mygroups))
// foreach($grps_ids AS $grps_key_id => $grps_mygroups)
{
if(!$grps_mygroupsinfo['image_name'])
{
$grps_mygroupsinfo['image_name'] = "<img src=\"" . $vbulletin->options['bburl'] . "/" . $stylevar['imgdir_grps'] . "/grps_mygroups_noimage.gif\" alt=\"" . $grps_mygroupsinfo[title] . "\" border=\"0\" /><br />";
}
else
{
$grps_mygroupsinfo['image_name'] = "<img src=\"../groups/grps_imgs/defaults/" . $grps_mygroupsinfo['image_name'] . "\" width=\"100\" alt=\"" . $grps_mygroupsinfo[title] . "\" border=\"0\" /><br />";
}
if ($grps_mygroupsinfo['leaderid'] == $userinfo['userid'])
{
$grps_mygroupsinfo['leader'] = "<img src=\"" . $vbulletin->options['bburl'] . "/" . $stylevar['imgdir_grps'] . "/grps_leader.gif\" alt=\"" . $grps_mygroupsinfo['title'] . " Leader\" border=\"0\" /><br />";
}
else
{
$grps_mygroupsinfo['leader'] = FALSE;
}
$mygroups .= "
<li id=\"grpsgroupsbullets\">
<a href=\"" . $baselocation . "/groups/groups.php?" . $vbulletin->session->vars['sessionurl'] . "g=" . $grps_mygroupsinfo['groupid'] . "\" title=\"" . $grps_mygroupsinfo['title'] . "\"><b>" . fetch_trimmed_title($grps_mygroupsinfo['title'], 15) . "</b></a><br />
" . $grps_mygroupsinfo['image_name'] . "
" . $grps_mygroupsinfo['leader'] . "
</li>
";
}
$mygroups .= "</ul>";
//eval('$grps_mygroupsprofilebits .= "' . fetch_template("groups_usercp_groupsbits") . '";');
$grps_mygroupsprofilebits = $mygroups;
}
And of course make the plugin active.
Now go edit your memberinfo template and add $grps_mygroupsprofilebits where you want them to appear on the user's public profile page.