Antonio Coelho
Member
Hi all,
I've searched but was unable to find what I am looking for, hence asking for your help if possible.
I have some users (90+) that don't log in to the forum for quite some time, and I would like to ban them, although giving a reason to the ban.
To find the users that have not logged in this year and that are not banned, I used the following statement:
select * from xf_user
where last_activity < unix_timestamp ('2013-01-01 00:00:00')
and is_banned = 0
To simply ban them on the database, I can use the following sql statement:
update xf_user set is_banned = 1
where last_activity < unix_timestamp ('2013-08-01 00:00:00') and is_banned = 0
And I assume that the ban reason goes on xf_user_ban table, but this table is indexed by user_id. Is there any way to apply the xf_user.is_banned = 1 and add the user id and ban reason to xf_user_ban in the same sql statement?
Something like the below (which obviously doesn't work)
update xf_user set is_banned = 1 and xf_user_ban set user_reason = 'Yearly Login missing'
where last_activity < unix_timestamp ('2013-08-01 00:00:00') and is_banned = 0
Thanks in advance.
Antonio
I've searched but was unable to find what I am looking for, hence asking for your help if possible.
I have some users (90+) that don't log in to the forum for quite some time, and I would like to ban them, although giving a reason to the ban.
To find the users that have not logged in this year and that are not banned, I used the following statement:
select * from xf_user
where last_activity < unix_timestamp ('2013-01-01 00:00:00')
and is_banned = 0
To simply ban them on the database, I can use the following sql statement:
update xf_user set is_banned = 1
where last_activity < unix_timestamp ('2013-08-01 00:00:00') and is_banned = 0
And I assume that the ban reason goes on xf_user_ban table, but this table is indexed by user_id. Is there any way to apply the xf_user.is_banned = 1 and add the user id and ban reason to xf_user_ban in the same sql statement?
Something like the below (which obviously doesn't work)
update xf_user set is_banned = 1 and xf_user_ban set user_reason = 'Yearly Login missing'
where last_activity < unix_timestamp ('2013-08-01 00:00:00') and is_banned = 0
Thanks in advance.
Antonio