PDA

View Full Version : Using Titles in Showgroups


USODJA
01-29-2003, 12:37 PM
Is there a way to show a persons title after their name on the staff page.

Like Coordinators, CEO, yada yada...

Thanks

Xenon
01-30-2003, 12:38 PM
should be possible :)

open showgroups.php
find:$users = $DB_site->query("
SELECT
$locationfieldselect usergroup.title, user.username, user.userid, user.invisible, user.receivepm,
user.usergroupid, user.lastactivity, user.lastvisit
FROM usergroup
LEFT JOIN user ON (usergroup.usergroupid = user.usergroupid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
WHERE usergroup.showgroup = 1
");

and change it to:
$users = $DB_site->query("
SELECT
$locationfieldselect usergroup.title, user.title AS usertitle, user.username, user.userid, user.invisible, user.receivepm,
user.usergroupid, user.lastactivity, user.lastvisit
FROM usergroup
LEFT JOIN user ON (usergroup.usergroupid = user.usergroupid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
WHERE usergroup.showgroup = 1
");

then find:
$users = $DB_site->query("
SELECT
$locationfieldselect forum.forumid, forum.title AS forumtitle,
user.username, user.userid, user.invisible, user.receivepm, user.lastactivity, user.lastvisit
FROM moderator
LEFT JOIN user ON (user.userid = moderator.userid)
LEFT JOIN forum ON (forum.forumid = moderator.forumid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
WHERE forum.active = 1
ORDER BY user.username ASC, forum.displayorder ASC
");

and change to:
$users = $DB_site->query("
SELECT
$locationfieldselect forum.forumid, forum.title AS forumtitle,
user.title AS usertitle, user.username, user.userid, user.invisible, user.receivepm, user.lastactivity, user.lastvisit
FROM moderator
LEFT JOIN user ON (user.userid = moderator.userid)
LEFT JOIN forum ON (forum.forumid = moderator.forumid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
WHERE forum.active = 1
ORDER BY user.username ASC, forum.displayorder ASC
");

then you should be able to use $user[usertitle] in the showgroupbit templates :)

USODJA
01-30-2003, 04:47 PM
I get this error:

Database error in vBulletin 2.2.9:

Invalid SQL:
SELECT
usergroup.title, user.title AS usertitle, user.username, user.userid, user.invisible, user.receivepm,
user.usergroupid, user.lastactivity, user.lastvisit
FROM usergroup
LEFT JOIN user ON (usergroup.usergroupid = user.usergroupid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
WHERE usergroup.showgroup = 1

mysql error: Unknown column 'user.title' in 'field list'

mysql error number: 1054

USODJA
02-01-2003, 02:34 AM
:confused:

Xenon
02-01-2003, 09:55 AM
replace user.title with user.usertitle

USODJA
02-01-2003, 01:15 PM
Thanks it worked like a charm, I run an association site, so they were all bugging me to list the members with titles on a page, and I knew modifiying this one would do the trick....

Thanks again!

Xenon
02-02-2003, 12:07 PM
:)
you're welcome

blonboy
09-24-2006, 03:53 PM
I would like to be able to use this modification as well, but it seems the code has changed substantialy since this posting. Anyone willing to update what would be the necessary changes? Thanks In Advance.

Luggruff
09-29-2006, 07:45 AM
now it seems like it looks like this:
// get usergroups who should be displayed on showgroups
// Scans too many rows. Usergroup Rows * User Rows
$users = $db->query_read_slave("
SELECT user.*, usergroup.usergroupid, usergroup.title, user.options, usertextfield.*, userfield.*,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
FROM " . TABLE_PREFIX . "usergroup AS usergroup
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.usergroupid = usergroup.usergroupid OR FIND_IN_SET(usergroup.usergroupid, user.membergroupids))
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=user.userid)
WHERE (usergroup.genericoptions & " . $vbulletin->bf_ugp_genericoptions['showgroup'] . ")
");

What to do now?

EDIT:
Why even go that way? You could just go to the showgroups_usergroupbit template in templatemanager.. then you could just copy the usertitle code from postbit and paste it there? ;)

sinucello
01-18-2007, 09:19 PM
Hi,

EDIT:
Why even go that way? You could just go to the showgroups_usergroupbit template in templatemanager.. then you could just copy the usertitle code from postbit and paste it there? ;)ASFAIK you can only display in your template what is selected in the code. So pasting the template-parts there won`t help if you don`t extract the necessary data in the php-files using that template.

Ciao,
Sacha