I would not use two fields like you did -- because I would not want to depend on a task to change back the active
field when the un-ban date is reached.
Instead, I would only use one datetime field, called like banned_until
; and this field would either:
- Be
NULL
when the user is not banned,
- Or contain the date until which the user is banned.
Then, when the user tries to do something (log-in, post, ...), I would check that :
- This field is
NULL
, in which case the user is not banned
- Or that the date contained in this field is in the past, in which can the user has been banned, but is no longer.
In the second case, you could even reset the field to NULL
, as the un-ban date has been reached.