PDA

View Full Version : Trap [user changed field21, field22, etc]


SDB
08-23-2007, 02:16 PM
I want to log when a user changes certain fields / options in their profile.

Is there a way to trap which field a user has changed when they update their profile?

Farcaster
08-23-2007, 05:06 PM
Yes, you could check for changes on the profile_updateprofile hook and then insert a log into a custom table.

A simplified example of what this might look like:


$newvalue = $vbulletin->GPC['userfield']['field2'];
$oldvalue = $vbulletin->userinfo['field2'];

if ($oldvalue <> $newvalue) {

$db->query_write("
INSERT INTO profilelog (oldvalue,newvalue)
VALUES ('".$db->escape_string($oldvalue)."','".$db->escape_string($newvalue)."')";


}

Marco van Herwaarden
08-23-2007, 05:13 PM
Not with standard vBulletin, you will need to write a modification for that.

I think you will find examples of such coding in Userprofile Changed Date in Member Profile & recent changed on forumhome (https://vborg.vbsupport.ru/showthread.php?t=101462)

SDB
08-25-2007, 11:24 AM
Thank you farcaster

Just what I needed :)