PDA

View Full Version : SQL Query - Change Last Activity Date


BGN64
07-17-2012, 01:45 PM
My forum was imported from another system. All user that have NOT logged in since the change over have a last activity date that is blank. In addition the "Receive Admin Emails" is unchecked.

I would like to run a couple of query's.

One: If the last activity is blank THEN set receive admin emails to YES

Two: Set last activity to a date so it isn't blank. I am using a plugin that sends reminder emails to in inactive users and they are being left out because of the no date issue.

Can anyone help? Thanks!

kh99
07-17-2012, 05:14 PM
Try this:

UPDATE user SET options = options + 16 WHERE lastactivity = 0 AND NOT (options & 16)


and
UPDATE user SET lastactivity=UNIX_TIMESTAMP('2012-01-01 15:30:00') WHERE lastactivity = 0


Of course you can set the date and time to whatever you want.

BGN64
07-17-2012, 05:53 PM
That worked perfectly. Thank You!!