View Full Version : Custom User Status by Usergroup

29 Jun 2002, 04:40
I could not find a way to add an additional user status field based on usergroup other than setting a override, which got rid of the normal usertitle based on post count and I didn't want that. This is my solution.

This hack adds an additional field to the usergroup table and allows you to display that custom group status field in addition to the normal usertitle that is defined either custom for the user or normally by number of posts without overriding the usertitle variable.

The end result gives you something like this (depending on how you edit your postbit template) for the output:

Tyro Hacker
[Custom Group Status Here]
[Users Avatar]
[Users other details]

The custom group status is set within the cp from the user group modify function for each group you want to add this additional status field to.

Questions, Problems, etc.. ask here as I am unable to provide support via email.

29 Jun 2002, 05:13
# NOTE: This code has been added to the download file. If you have a copy of the file without the User Profile mods, these instructions are for you. Otherwise, use what's in the file.

If you want to add the new custom user status to the users profile here's the edits to do so (These should be all one line and are broken up here to keep the screen from scrolling):

Edit admin/functions.php
if (!isset($usercache[$userid])) {
SELECT user.*,userfield.*
FROM user
LEFT JOIN userfield ON userfield.userid=user.userid WHERE user.userid='$userid'");

replace with:
if (!isset($usercache[$userid])) {
SELECT user.*,userfield.*, usergroup.groupcustomstats
FROM user
LEFT JOIN usergroup ON usergroup.usergroupid=user.usergroupid
LEFT JOIN userfield ON userfield.userid=user.userid WHERE user.userid='$userid'");

Then just add the following variable to your getinfo template as you want it to display.

29 Jun 2002, 07:48
I was thinking about something like this just last week. Good job :)

Dean C
29 Jun 2002, 08:42
didn't work for me... :(

29 Jun 2002, 09:34
im going to try when i wake up later.

im preatty tired and watching mr. deeds

29 Jun 2002, 09:43
Mist: I think I figured out the problem.. a # character was right before the second replacement db query. I have fixed that in the file and it should install no problem now.

The hack code above is based on an un-hacked vB 2.2.6 install, but works wonderful with the Sig and Avatars by Usergroup (http://www.vbulletin.org/forum/showthread.php?s=&threadid=38952) hack.

I just tested the updated code on a fresh install of vB 2.2.6 and it worked perfectly.

29 Jun 2002, 18:58
The download file has been updated to include the steps to add the new Group Custom Status to the user's profile page.

15 Jul 2002, 04:37
If anyone has had any problems with this, please let me know. otherwise I'd like to move this up to a Final release.

15 Aug 2002, 11:08
Just wanted to say, it's a great hack! :D Installed it yesterday and it works perfectly! :D Thanks :).

Chris M
02 Nov 2002, 11:29
Have you ran the query?