Version: , by TECK
Developer Last Online: Nov 2023
Version: Unknown
Rating:
Released: 04-03-2002
Last Update: Never
Installs: 0
No support by the author.
i try to call the usergroup name in showthread.php with this:
PHP Code:
$usergroups=$DB_site->query("SELECT usergroup.title FROM usergroup");
while ($usergroup=$DB_site->fetch_array($usergroups)) {
$grouptitle=$usergroup['title'];
}
it will not work. any ideas why?
i want to be able to call the usergroup name associated with the user, in postbit template.
thanks for taking the time to answer.
if (!$getperms['cangetattachment']) {
$viewattachedimages=0;
}
i also tried to add it in functions.php, in Start buildpostbit function... same thing. any idea why is doing this?
btw, this is the answer neo gave me in msn:
Quote:
ohh well.. you can query Chen about the error, I am sure he can pull roses out of his mouth along with the answer
Ok, If I understand this correctly, you want to display the group name of the user along with is other info.
This is the original query in showthread.php:
PHP Code:
$posts=$DB_site->query("
SELECT
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,".iif($forum[allowicons],'icon.title as icontitle,icon.iconpath,',\
'')."
attachment.attachmentid,attachment.filename,attachment.visible AS attachmentvisible,attachment.counter
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline","")."
FROM post
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
".iif ($avatarenabled,"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 $postids ORDER BY dateline $postorder ");
This is how you change this query to get thegroup title with it:
PHP Code:
$posts=$DB_site->query("
SELECT
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*, usergroup.title as grouptitle,".iif($forum[allowicons],'icon.titl\
e as icontitle,icon.iconpath,','')."
attachment.attachmentid,attachment.filename,attachment.visible AS attachmentvisible,attachment.counter
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline","")."
FROM post
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
LEFT JOIN usergroup ON user.usergroupid=usergroup.usergroupid
".iif ($avatarenabled,"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 $postids ORDER BY dateline $postorder ");
So in your template you can access the group title via $post[grouptitle].
I added the following text to the query: usergroup.title as grouptitle and LEFT JOIN usergroup ON user.usergroupid=usergroup.usergroupid
I tried it and I was able to show the group title along with the user info.