PDA

View Full Version : Usergroup Logging


KGodel
01-02-2013, 08:21 PM
Hey all! I was wondering if vBulletin logs or stores the dates on which a user's usergroup last changed or anything. The reason is, we have a system where after a user has been inactive for 30 days, they are moved to an inactive status, and they have to request to be moved back to active status. We want the users to be deleted after 30 days in this inactive usergroup, even if they have logged in. Does vBulletin already store the information needed to do this, or does anyone know of an easy way to set a system like this up? Thanks!

DAMINK
01-02-2013, 09:15 PM
There is definitely a mod for vb4 that does what you want mate.
Depending on many factors you can move users back and forth between groups.
I cant remember which one it was but there is definitely one there that should fit your needs.

ForceHSS
01-02-2013, 09:23 PM
On each members profile you will see Profile [View change history] just above the name. Screenshot uploaded so you can see. Not sure if this is what you are after. Seen a few mods that could help try this one (https://vborg.vbsupport.ru/showthread.php?t=285208)

KGodel
01-02-2013, 09:45 PM
Yea, these all do what I already know can be done. The issue is, say people are in usergroup X, the inactive group, I want it to delete accounts based on days in that usergroup, not days inactive.

kh99
01-02-2013, 09:56 PM
There is a userchangelog table, and assuming that the user was moved in some way that logs the change (i.e. using the user datamanager), then there will be an entry for that change. I think you could have a plugin that queries to find users that were moved to that group around 30 days ago, and decide if they should be deleted. I think it might be a little tricky because if the user was moved back and forth within the past 30 days, then you might find a record that says they were moved to the invalid group 30 days ago, but they might not be eligible for deletion.

I've been thinking about this because someone else asked about kicking members out of a "publicly joinable" group after a certain amount of time.

KGodel
01-02-2013, 10:01 PM
Yea, this is unfortunately a problem, since we use a mod to move people to our "inactive users" group, and it is not logging that. Hmmm.

kh99
01-02-2013, 10:06 PM
Well, yeah, if the mod doesn't use the datamanager, then I think the only thing you could do is change the mod, either use the datamanager or create your own log.

KGodel
01-02-2013, 10:12 PM
I haven't messed to much with altering mods. Is there an article somewhere that details using it or implementing it?

kh99
01-02-2013, 10:29 PM
I think there is an article on using data managers in general (although I can't find it right now - I don't think it has "datamanager" or "data manager" in the title). Anyway, probably the easiest thing would be to find code that does what you want and use that. For changing the user's main group, it would be something like:

$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userdata->set_existing($user);
$userdata->set('usergroupid', $newgroupid);
$userdata->save();



where $user is an array that has to contain some of the user's data (at least the userid, I think). There's also an issue with user titles - if changing the usergroup would change the usertitle, then you'd have to do that as well (but I guess if the mod you're using isn't doing that now, then you wouldn't have to worry about it).

You might try asking the mod author about it, in the mod thread (if he or she is still around).

KGodel
01-02-2013, 11:20 PM
Thanks. The code doesn't look too complicated, its a mod Paul wrote, so I'll post there. Thanks as always kh99.