The Arcive of vBulletin Modifications Site. |
|
usergroup name? Details »»
|
|||||||||||||||||||||||||
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. Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
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]");
$grouptitle = $getgrouptitle['title'];
|
|
#3
|
||||
|
||||
![]() Code:
Database error in vBulletin 2.2.4: Invalid SQL: SELECT title FROM usergroup WHERE usergroupid= mysql error: You have an error in your SQL syntax near '' at line 1 mysql error number: 1064 Script: http://localhost/forum/forum/showthread.php?threadid=7 Referer: http://localhost/forum/forumdisplay.php?forumid=2 PHP Code:
btw, this is the answer neo gave me in msn: Quote:
|
|
#4
|
||||
|
||||
|
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 |
|
#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.
|
|
#6
|
||||
|
||||
|
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? |
|
#7
|
||||
|
||||
|
Do a query in showthread.php that caches usergroup titles in an array (id => title) then use that in getpostbit().
|
|
#8
|
||||
|
||||
|
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.
|
|
#9
|
||||
|
||||
|
thanks alot...
|
![]() |
|
|