Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

need help with database query for my theme

Aloittaja timt, heinäkuu 12, 2006, 08:12:08 IP

« edellinen - seuraava »

timt

I am modifying the standard theme in my forum (v. 1.0.7)

I want to add the user's membergroup to the user info box at the top of every page. At this point, I have added a line of code to the main template file: (The last line below is the one added)

   // Only tell them about their messages if they can read their messages!
   if ($context['allow_pm'])
      echo ', ', $txt[152], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt[153] : $txt[471], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'];
   echo '.';
echo '<br>Your mastery level is: ', $user_info['groups'][1];


This seems to return the group ID of the member's group... I would really like to have the name of the group up there, but not sure how to do this.  I would describe myself as an utter newbie with php and mysql, but have some coding background using other languages.

I know I could get the proper info with a simple SQL SELECT statement, but have no info around the table structure, or how to build and execute a query with php (or for that matter, even the proper way to assign that to a variable, or otherwise display it properly)

Any help with this will be much appreciated!

timt


Advertisement: