Thanks for the response!
I've worked out how to update the variable, but it hasn't been updating because it wasn't in the database. I thought that what I needed was a new row, not a new column. Aren't
lastvisit and
lastactivity rows? If so, then I need a new row, because I need to store a time like those values. I wouldn't know how to add a row - if it is a row. Hopefully, I've just got the two terms confused.
--------------- Added [DATE]1223918858[/DATE] at [TIME]1223918858[/TIME] ---------------
Well, I managed to figure out how to just add a row. I added the row
lastrepadd to the
user table. It has the properties of the other time variables, like
lastvisit.
This is the PHP code that I've got planted in the index.php file. I can't figure out why it's not working.
PHP Code:
if ( $vbulletin->userinfo['usergroup'] == 2 OR $vbulletin->userinfo['usergroup'] > 3 )
{
if (TIMENOW - $vbulletin->userinfo['lastrepadd'] >= 86400)
{
$reputationlevel = $db->query_first_slave("
SELECT reputationlevelid
FROM " . TABLE_PREFIX . "reputationlevel
WHERE " . $vbulletin->userinfo['reputation'] + 1 . " >= minimumreputation
ORDER BY minimumreputation
DESC LIMIT 1
");
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($vbulletin->userinfo);
$userdata->set('lastrepadd', TIMENOW);
$userdata->set('reputation', $vbulletin->userinfo['reputation'] + 1);
$userdata->set('reputationlevelid', intval($reputationlevel['reputationlevelid']));
$userdata->save();
}
}
What I'm trying to do with this is give a user 1 reputation point every day as long as they login (or are already logged in and just visit). Any ideas as to why this isn't working?