MyBB Community Forums

Full Version: Usegroup Legend Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
DamYan Wrote:I found! Big Grin

http://community.mybboard.net/showthread...7#pid50267
http://community.mybboard.net/showthread...9#pid53369

Thanks for advice Wink

That won't work if you use that mod of CraKteR cause it's reading the usergroups from the cache =P
LeX- Wrote:That won't work if you use that mod of CraKteR cause it's reading the usergroups from the cache =P

I have deacitvated this plugin and change some code in files and templates Smile
Yeah, that second one is what I had been looking for! Don't know why I couldn't find it, but at least you did! Smile I'll try it again and see if it works!

edit: Hmmm...can anyone update that code for 1.2?
judel Wrote:Yeah, that second one is what I had been looking for! Don't know why I couldn't find it, but at least you did! Smile I'll try it again and see if it works!

edit: Hmmm...can anyone update that code for 1.2?

Don't see much differents but OK =P

Code

	$query = $db->query("SELECT title, namestyle, gid FROM ".TABLE_PREFIX."usergroups ORDER BY title ASC");
	$usertitles = "";
	while($usertitle = $db->fetch_array($query)) 
	{
		$format = $usertitle['namestyle'];
		$userin = substr_count($format, "{username}");
		if($userin == 0)
		{
			$format = "{username}";
		}
		$format = stripslashes($format);
		$usertitles .= "[ ".str_replace("{username}", $usertitle['title'], $format)." ]";
	} 

Template

<tr> <td class="tcat"><strong>Group Legend</strong></td></tr>
<tr> <td class="trow1">{$usertitles}</td></tr>
Lex, does that code replace something? Where does it go? Smile And I mean the first part. I know where the second part goes in the template.
judel Wrote:Lex, does that code replace something? Where does it go? Smile And I mean the first part. I know where the second part goes in the template.

At the same place that Zaher told in his post

http://community.mybboard.net/showthread...9#pid53369

In your index.php above the eval of 'whosonline' template =P
I will update your code LeX with code from http://community.mybboard.net/showthread...7#pid50267

Code

	$query = $db->query("SELECT title, namestyle, gid FROM ".TABLE_PREFIX."usergroups WHERE gid!=1 ORDER BY isbannedgroup ASC,showforumteam DESC, issupermod DESC, usertitle ASC");
	$usertitles = "";
	while($usertitle = $db->fetch_array($query)) 
	{
		$format = $usertitle['namestyle'];
		$userin = substr_count($format, "{username}");
		if($userin == 0)
		{
			$format = "{username}";
		}
		$format = stripslashes($format);
		$usertitles .= "[ ".str_replace("{username}", $usertitle['title'], $format)." ]";
	} 

Template

<tr> <td class="tcat" colspan="2"><strong>Group Legend</strong></td></tr>
<tr> <td class="trow1" colspan="2">{$usertitles}</td></tr>

And effect is:

[attachment=6351]
Hmmm..I guess I was hoping there was something I could change in the actual plugin, so I wouldn't need to make any core file changes.
judel Wrote:Hmmm..I guess I was hoping there was something I could change in the actual plugin, so I wouldn't need to make any core file changes.

You could use the query instead of reading it from the cache =P
Pages: 1 2 3