Not Solved A Profile Question
#1
Not Solved
I am currently modifying my profile page. I'd like it to display the usergroup name of a person who's profile I am viewing. I have tried a number of codes, and $memprofile[usergroup] seems to work somewhat - it displays the usergroup number. But what I want is it to display the usergroup name, not the number.

How do I get it to display the usergroup name?
Reply
#2
Not Solved
The following will echo the usergroups the person belongs to (including secondary user groups). You will have to adapt it to work for your profile page.
$query = $db->query("SELECT title FROM " . TABLE_PREFIX . "usergroups g LEFT JOIN " . TABLE_PREFIX . "users u ON g.gid = u.usergroup OR g.gid IN u.additionalgroups WHERE u.uid = " . $memprofile[uid]);
while($row = $db->fetch_array($query)){
echo $row['title'] . "<br/>";
}
If you just want to return the title of the primary user group the user is in then use
$query= $db->query("SELECT title FROM " . TABLE_PREFIX . "usergroups WHERE gid = " . $memprofile['usergroup']);
Updated Site!
My mods
1.1: MyBB Zip Installer, Easy Install v2.0, Cash/Points plugin, PayPal/Subscriber, Reply by email, Advanced Plugins
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)