MyBB Community Forums

Full Version: Display additional usergroups on threads.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have a plugin where I can have additional usergroups on profiles but I want to make it so it'll display on threads as well, is their a way to do this? Thanks!
What plugin is it?
Bumping this up. I still need this. Thanks! Wink
Which plugin is that plz post your profile templete here
additional usergroup images plugin by jammerx2 works fine for me and shows additional groups in threads
May be just Pull all the groups from the database store them in some array, or variable & eval them using a for loop.

Like this:


	$cache = $cache->read("usergroups");
	$groups = explode(',',$memprofile['additionalgroups']);	

	foreach($groups as $group)
	{
            $userbarimage = $groupcache[$group]['image'];
            $imghtml = "<img src=\"$userbarimage\">";
            eval("\$groupimages .= \"".$imghtml."\";");
        }

Now to go to your template & use {$groupimages} to display the images Smile

I just made a raw code. Modify it as per your needs.
(2013-08-01, 10:29 AM)Cedric Wrote: [ -> ]May be just Pull all the groups from the database store them in some array, or variable & eval them using a for loop.

Like this:


	$cache = $cache->read("usergroups");
	$groups = explode(',',$memprofile['additionalgroups']);	

	foreach($groups as $group)
	{
            $userbarimage = $groupcache[$group]['image'];
            $imghtml = "<img src=\"$userbarimage\">";
            eval("\$groupimages .= \"".$imghtml."\";");
        }

Now to go to your template & use {$groupimages} to display the images Smile

I just made a raw code. Modify it as per your needs.


Why use "eval" ? No need, just concatenate the contents of $imghtml and use {$imghtml}:

Quote: $cache = $cache->read("usergroups");
$groups = explode(',',$memprofile['additionalgroups']);

foreach($groups as $group)
{
$userbarimage = $groupcache[$group]['image'];
$imghtml .= "<img src=\"$userbarimage\">";
}
Using EVAL to properly parse PHP VARS inside the $imghtml.
(2013-08-01, 10:38 AM)Cedric Wrote: [ -> ]Using EVAL to properly parse PHP VARS inside the $imghtml.

What lol ? Thats completely not correct.

Infact you shouldn't even be using eval. Read this and learn.

http://dandoescode.com/blog/2012/08/28/i...ot-and-no/
(2013-08-01, 10:38 AM)Cedric Wrote: [ -> ]Using EVAL to properly parse PHP VARS inside the $imghtml.

You don't need eval() for that. Double quotes expand variables.
Pages: 1 2