Is there a way to delete the non-activated users from Joomla after X days.
Advertisement
How to auto delete the non-activated users.
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Intern
- Posts: 79
- Joined: Fri Jun 19, 2009 7:00 pm
How to auto delete the non-activated users.
Hi,
Is there a way to delete the non-activated users from Joomla after X days.
Is there a way to delete the non-activated users from Joomla after X days.
Advertisement
- toivo
- Joomla! Master
- Posts: 18137
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: How to auto delete the non-activated users.
The simplest way is to use SQL queries, like the attached examples, assuming that you know your way around phpMyAdmin, MySQL Workbench or a similar MySQL client.
The first example lists the users who have not been activated within the set number of days. The second script creates first a temporary table of the users to be deleted, then removes the entries of those users from the table _user_usergroup_map and deletes them from the _users table.
This example could run without the temporary table, but it simplifies the queries when associated tables created by third party components during the registration need to be cleaned up, too.
Remember to back up the database first, just in case! Replace 'puhj1' with your own table prefix and set the variable @days to the number of days required.
List the candidates, showing the activation hash as verification:
Delete the users who have not been activated within the specified number of days:
The first example lists the users who have not been activated within the set number of days. The second script creates first a temporary table of the users to be deleted, then removes the entries of those users from the table _user_usergroup_map and deletes them from the _users table.
This example could run without the temporary table, but it simplifies the queries when associated tables created by third party components during the registration need to be cleaned up, too.
Remember to back up the database first, just in case! Replace 'puhj1' with your own table prefix and set the variable @days to the number of days required.
List the candidates, showing the activation hash as verification:
Code: Select all
SET @days = 10;
SELECT id, username, DATE_FORMAT(registerDate, '%Y-%m-%d') AS registered, activation FROM puhj1_users
WHERE ((registerDate < DATE_SUB(CURRENT_DATE, INTERVAL @days DAY)) AND (activation NOT IN (' ', '0')));
Code: Select all
SET @days = 10;
DROP TEMPORARY TABLE IF EXISTS delete_users;
CREATE TEMPORARY TABLE delete_users
SELECT id FROM puhj1_users
WHERE ((registerDate < DATE_SUB(CURRENT_DATE, INTERVAL @days DAY)) AND (activation NOT IN (' ', '0')));
DELETE m FROM puhj1_user_usergroup_map m INNER JOIN delete_users ON id = user_id;
DELETE u FROM puhj1_users u INNER JOIN delete_users d ON d.id = u.id;
Toivo Talikka, Global Moderator
-
- Joomla! Intern
- Posts: 79
- Joined: Fri Jun 19, 2009 7:00 pm
Re: How to auto delete the non-activated users.
Is there a way to run this automatically even Hour or every Day?
I'm just done updating to Joomla 4, would be the new "Scheduled Tasks" a solution for doing this?
I'm just done updating to Joomla 4, would be the new "Scheduled Tasks" a solution for doing this?
- toivo
- Joomla! Master
- Posts: 18137
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: How to auto delete the non-activated users.
It would be possible with cron or Scheduled Tasks but a PHP CLI script is needed.
Alternatively, the sequence of SQL commands could be fired from a task plugin, described in this article in the Joomla! Community Magazine: Get to know the new Joomla! Task Scheduler.
Alternatively, the sequence of SQL commands could be fired from a task plugin, described in this article in the Joomla! Community Magazine: Get to know the new Joomla! Task Scheduler.
Toivo Talikka, Global Moderator
- Webdongle
- Joomla! Master
- Posts: 45086
- Joined: Sat Apr 05, 2008 9:58 pm
Re: How to auto delete the non-activated users.
https://extensions.joomla.org/extension ... estbefore/
https://extensions.joomla.org/extension ... r-cleaner/
may be of interest
https://extensions.joomla.org/extension ... r-cleaner/
may be of interest
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Intern
- Posts: 79
- Joined: Fri Jun 19, 2009 7:00 pm
Re: How to auto delete the non-activated users.
I also stubble across those paying plugins. But no one works with the Joomla 4 "Scheduled Tasks" and i would be really nice to have an open-source plugin for this, it should even be included by default in Joomla to remove the spam accounts or user typo errors in emails.
I put a $20 bounty on such a open-source "Scheduled Tasks" plugin, because my coding sucks and want to make Joomla better.
I put a $20 bounty on such a open-source "Scheduled Tasks" plugin, because my coding sucks and want to make Joomla better.

- AMurray
- Joomla! Master
- Posts: 10611
- Joined: Sat Feb 13, 2010 7:35 am
- Location: Australia
Re: How to auto delete the non-activated users.
The second one listed above I assume it has an internal mechanism that checks for users not logged in (since registration) for X days.
The first one is for J3 only and not updated in the last 14 months.
The first one is for J3 only and not updated in the last 14 months.
Regards - A Murray
Global Support Moderator
Global Support Moderator
- Webdongle
- Joomla! Master
- Posts: 45086
- Joined: Sat Apr 05, 2008 9:58 pm
Re: How to auto delete the non-activated users.
Oh yes. my bad I copy/pasted the wrong url
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
- mandville
- Joomla! Master
- Posts: 15162
- Joined: Mon Mar 20, 2006 1:56 am
- Location: The Girly Side of Joomla in Sussex
Re: How to auto delete the non-activated users.
could someone be so bold as do a free plugin for this?
HU2HY- Poor questions = Poor answer
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
portable mini golf https://www.puttersminigolf.co.uk/
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
portable mini golf https://www.puttersminigolf.co.uk/
- toivo
- Joomla! Master
- Posts: 18137
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
- toivo
- Joomla! Master
- Posts: 18137
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: How to auto delete the non-activated users.
One has to learn to walk before running... Instead of a task plugin, here is a Joomla 4 back end module called NonActivated for starters. The module lists and deletes user accounts that remain nonactivated after a set number of days. It is a rough product but at least it gives me inspiration to tackle the task plugin.
The module is safe to use because it relies on the User::delete() function to delete users and clean the #_user_usergroup_map. The User::delete() function triggers also the onUserBeforeDelete and onUserAfterDelete plugin events.
Feedback and suggestions are welcome! If this module is found useful, it will be submitted to JED.
The module is safe to use because it relies on the User::delete() function to delete users and clean the #_user_usergroup_map. The User::delete() function triggers also the onUserBeforeDelete and onUserAfterDelete plugin events.
Feedback and suggestions are welcome! If this module is found useful, it will be submitted to JED.
You do not have the required permissions to view the files attached to this post.
Toivo Talikka, Global Moderator
-
- Joomla! Intern
- Posts: 79
- Joined: Fri Jun 19, 2009 7:00 pm
Re: How to auto delete the non-activated users.
Nice, After a quick test run i couldn't find any errors.
It's astonishing how many user type their emails wrong. I surprised that some big Joomla sites have still user ID's left.

It's astonishing how many user type their emails wrong. I surprised that some big Joomla sites have still user ID's left.
-
- Joomla! Intern
- Posts: 79
- Joined: Fri Jun 19, 2009 7:00 pm
Re: How to auto delete the non-activated users.
A scheduled task would be excellent to fully atomize it. Because the back-end module is only triggered when someone logs into the back-end. 
I'm also don't get it way Joomla has after so long not added something like this by default, including a Clear Caches Scheduled Task.

I'm also don't get it way Joomla has after so long not added something like this by default, including a Clear Caches Scheduled Task.

Advertisement