News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to display membergroup on index

Started by Zirc, September 19, 2010, 05:10:13 PM

Previous topic - Next topic

Zirc

SMF 2.0RC3

Okay so I would like to display the users membergroup when they are logged in up near the header.  You can see in the attached image that the membergroup should be between Greetings and Zirc but I don't know the correct code to call it from the database.  I've tried $context['members']['group'] like on the member list page but that didn't do anything.

Here is the code I have

// Display user name and time.
echo '
<table align="center" bordercolor="lime" width="99%" cellpadding="0" cellspacing="0" border="0" >
<tr>';
if ($context['user']['is_logged'])
echo '
<td align="center"  width="20"><img src="', $settings['theme_url'], '/images/titlebgheadlft.jpg"></td>
<td class="titlebghead" height="32" width="44%">
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
</td>';
else
echo '
<td align="center"  width="20"><img src="', $settings['theme_url'], '/images/titlebgheadlft.jpg"></td>
<td class="titlebghead" height="32" width="44%">

</td>';


Thanks

Akyhne

#1
It's $message['member']['group'] and it only works in the Display.template.php file.

There's a mod on it's way that (almost) does what you want: http://bryandeakin.com/index.php?topic=39.0
It just shows the icon instead of the name, but it can probalby be changed to do what you want.

Zirc

Hey thanks for the tip.  I was able to look at Runics mod and get what I wanted to do to work.

Topic solved.

Deaks

im glad my mod helped :)

However I have just this minute updated some small bugs in the mod ... missing text strings and the v1.4 mod wont uninstall correctly :(
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Zirc

Well I didn't exactly use the whole mod, just manually edited in the changes that I needed to make to call the member group from the database in the Load.php everything on the index template was custom code for my theme.

Advertisement: