PDA

View Full Version : show public usergroup in postbit


mfacer
09-22-2004, 02:11 PM
I've already seen one post here which suggests to use:


Crew: <if condition="is_member_of($post, 63)">Such and Such group</if><if condition="is_member_of($post, 64)">Such and Such Other group</if>


to display which public usergroup the user is in, in the postbit.
I don't want to hard code this as above, I'd like to somehow get the usergroup they are in, and display the title of the group - and maybe a hyperlink to the join page of that group.

Is this possible?
thanks.

Berethorn
02-05-2005, 10:36 PM
Yes, I would like to know this too. :)

Zachery
02-05-2005, 11:03 PM
Yes, I would like to know this too. :)
Would require quite abit of overhead i think....

Andreas
02-05-2005, 11:11 PM
*** Untested spinoff ***

In functions_showthread.php FIND

static $gotrank, $sigcache, $checkperms, $postelement, $month, $day, $year, $counter;


REPLACE that with

static $gotrank, $sigcache, $checkperms, $postelement, $month, $day, $year, $counter, $gotpgroups;


FIND

// get rank


ABOVE that ADD

if (!$gotpgroups[$post['userid']])
{
$membergroups = explode(',', $post['membergroupids']);
foreach ($membergroups as $membergroupid)
{
$usergroup = $usergroupcache[$membergroupid];
if ($usergroup['ispublicgroup'])
{
$pgroups[] = "<a href=\"profile.php?$session[sessionurl]do=joingroup&amp;usergroupid=$membergroupid\">$usergroup[title]</a>";
}
}
if (is_array($pgroups))
{
$post['pgroupstr'] = implode(',', $pgroups);
$gotpgroups[$post['userid']] = $post['pgroupstr'];
}
else
{
$gotpgroups[$post['userid']] = '';

}
}
else
{
$post['pgroupstr'] = $gotpgroups[$post['userid']];

}


Then you can use $post[pgroupstr] in Template postbit.

Rukas
05-31-2005, 03:48 AM
^^ That doesnt work, it doesnt show up in the postbit :(

Andreas
05-31-2005, 08:45 AM
Fixed a small typo, should work now