View Full Version : associate $usergroup[title] with specific post?
let's suppose i have a board with users who can change their usertitle. as an admin i want to see what usergroup they are in, right under the usertitle.
this is what i tried:
showthread.php
$usergroups=$DB_site->query("SELECT title, usergroupid FROM usergroup");
while ($usergroup=mysql_fetch_object($usergroups)) {
if ($bbuserinfo['usergroupid']==6) {
$editgroup='[<a href="admin/usergroup.php?s=$session[sessionhash]&action=edit&usergroupid=$usergroup[usergroupid]">edit</a>]';
eval(...);
} else {
$editgroup='';
}
} i dont know how to associate the user with the usergroup, in postbit.
thanks for your help.
do you mean something like $post[usergroupid]
i want to be able to grab the usergroup title. for example to show the user is part of Administrators Group.
Admin
03-12-2002, 09:28 AM
In showthread.php replace:
avatardateline","")."
FROM post
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
with:
avatardateline","").",usergroup.title AS usergrouptitle
FROM post
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
LEFT JOIN usergroup ON (usergroup.usergroupid=user.usergroupid)
Then use $post['usergrouptitle'].
hmmm..Database error in vBulletin 2.2.4:
Invalid SQL:
SELECT
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,icon.title as icontitle,icon.iconpath,
attachment.attachmentid,attachment.filename,attach ment.visible AS attachmentvisible,attachment.counter,usergroup.tit le AS usergrouptitle
,avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline
FROM post
LEFT JOIN icon ON icon.iconid=post.iconid
LEFT JOIN usergroup ON usergroup.usergroupid=user.usergroupid
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid
WHERE post.postid IN (0,1,2)
ORDER BY dateline
mysql error: Cross dependency found in OUTER JOIN. Examine your ON conditions
mysql error number: 1120
Script: http://localhost/forum/forum/showthread.php?threadid=1
Referer: http://localhost/forum/forumdisplay.php?forumid=2
i will look into this and let you know where is the bug.. thanks for getting me started.. :)
ok.. i tried this:$usergroups=$DB_site->query("SELECT usergroup.usergroupid,usergroup.title
FROM usergroup
LEFT JOIN user ON user.usergroupid=usergroup.usergroupid");
while ($usergroup=$DB_site->fetch_array($usergroups)) {
echo "$usergroup[title]";
} it does echo all the usergroups.. why it would not work on your code? it doesnt make sense.. and what's up with all this Cross dependency found in OUTER JOIN?? i searched php.net and didnt find any relevant help. can you explain firefly? i want to learn this stuff.
thanks alot.
Admin
03-13-2002, 11:44 AM
I dunno... try moving the row with LEFT JOIN user above the row with LEFT JOIN usergroup. *shrugs*
any of the devs(or hackers) can give me a hint? freddie, PPN? can you make a roumanian happy? thank you for taking the time to read this.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.