Hi there,
In my forum, i would like to create a simple hello message on top for my users, i.e.,
Hello xxxxx you have xx messages
What i would like to know is what to do in order to correctly aplly the user_group color to my xxxxxx name.
I've read http://www.simplemachines.org/community/index.php?topic=19891.0, but is not what i want, not in all the forum, just in this simple line.
Mi code is
if ($context['user']['is_logged'])
echo '<br><br><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="50">
<tr>
<td width="30%" height="50">
<p align="right">
<a target="_blank" href="http://www.google.com">
<img border="0" src="/images_foro/busca_1.gif"></a>
</td>
<td width="40%" height="50"><p align="center">'
,$txt['zapping0'], '<b><color=" ' , => COLOR <= , '">',$context['user']['name'], '<font color="#000000"></b>, ',$txt['zapping1'], ' <b><a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $txt['zapping2'], '</a></b>, <b>', $context['user']['unread_messages'], '</b>' , $txt['zapping3'], '<br><br>Clique <b><a href="', $scripturl, '?action=unread;all">', 'aqui</a></b> para ler as mensagens novas no forum
</td>
<td width="30%" height="50">
<p align="left">
<a target="_blank" href="http://copacabana.dlsi.ua.es/es/text.php">
<img border="0" src="/images_foro/tradutor_1.gif"></a>
</td>
</tr>
</table>';
The part => COLOR <= is where the color should be, but no ideas.
Thank's in advance
KK
Ok, since no replys, here goes,
Is there in the $context variables, anything related to the group of the user ?
Something like $context['user']['usergroup'] ?
If so, my problem is solved, just a simple it elseif solution with all the groupcolors inside.
Thank's in advance,
KK
$context['user']['post_group_color'] or $context['user']['group_color'], depending on which one you want to use.
Thank's for the reply,
So it is suposed that if i do the following
Hello <b><color=" ' , $context['user']['group_color'], '">',$context['user']['name']<font color="#000000"></b>
Beeing a Administrator should give this Hello KillerKraft
But i doesn't. It gives the regular black color.
Any ideas ?
I did find the group_colors variable, but only in $ThemeUser, but no way to use it on index. Do i have any other way in order to save the value to a new variable, make it global and use it as i need ?
KK
Of course i can use a new database search but wath could happen is that all the forum goes slow.
KK
You can use $context['user']['is_admin'].
Finding the group they're in is easy, finding the color involves a query.
-[Unknown]
Thank's [Unknown],
Now the question is, $context['user']['is_admin'] gives a bolean result or the real value of the group ?
Of course, if i find the group, the colors would be easy, just a simple if...elseif case.
Always grateful,
KK
P.S. - I am learning at a fast speed
is_admin gives a boolean result.
[Unknown] - why exactly doesn't $context['user']['group_color'] or $context['user']['post_group_color'] work? It should be loaded in Load.php just like all the other user stuff...
Because it would be wasteful to load all that information from the membergroups table every page view.
$context['user']['groups'][0] is the primary group...
-[Unknown]