Hi,
I want to delete members who have never posted and logged into the forum for the past 1 year. Can we do this over the database?
@scarlet ,
You can delete inactive users in Dashboard > Forums > Members admin page, just filter users by "inactive", select all and delete.
Hi, thank you for your info but this feature is not work.
I see only 4 users in the inactive members section.
I know and I asked sql query for this request.
For example, can we list and delete users who have no posts in the database and according to the last login date?
Please try the following SQL in your Hosting Service phpMyAdmin database manager. Make sure the red marked table prefixes are correct and change the date range you want:
DELETE u, um, p FROM `wp_users` u
INNER JOIN `wp_wpforo_profiles` p ON p.`userid` = u.`ID`
LEFT JOIN `wp_usermeta` um ON um.`user_id` = u.`ID`
WHERE p.`posts` = 0
AND u.`ID` NOT IN( SELECT DISTINCT `post_author` FROM `wp_posts` )
AND p.`last_login` BETWEEN '2021-03-01' AND '2021-05-01'
In any case, don't forget to backup the following tables:
- wp_users
- wp_usermeta
- wp_wpforo_profiles