![]() |
usergroup name?
i try to call the usergroup name in showthread.php with this:
PHP Code:
i want to be able to call the usergroup name associated with the user, in postbit template. thanks for taking the time to answer. |
To get a user's usergroup's name, you need to use this:
Code:
$getgrouptitle = $DB_site->query_first("SELECT title FROM usergroup WHERE usergroupid=$userinfo[usergroupid]"); |
:(
Code:
Database error in vBulletin 2.2.4: PHP Code:
btw, this is the answer neo gave me in msn: Quote:
|
Chen I get this error when i use the code you posted
Fatal error: Call to a member function on a non-object in c:\program files\apache group\apache\htdocs\forum\admin\functions.php on line 71 I put the code in the build postbit area. and I use 2.2.5 |
Because $DB_site isn't avaiable in that function, and you shouldn't do that because it will add a query for every post in showthread.php.
|
so how do i do it chen?
can i add a $DB_site to the global, in that function? what do you recommend? in order to get the groupname in postbit? |
Do a query in showthread.php that caches usergroup titles in an array (id => title) then use that in getpostbit().
|
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:
PHP Code:
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. ;) Hope this helps. :) |
thanks alot... :)
|
All times are GMT. The time now is 12:09 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|