Automatically remove invalid b2evolution users

If your web site is anything like mine, you have spammers registering as users in the hope that they will have their spammy comments show up.

Here is how you can get b2evolution 1.8 to automatically delete the users if they have not validated their email address within 7 days.

First, copy this file to …/blogs/inc/CONTROL/cron/

Then edit …/blogs/inc/CONTROL/cron/crontab.php and add in these records:


‘delete_users’ => T_(‘Delete invalid users’),


‘delete_users’ => array(
‘ctrl’ => ‘cron/_delete_users.job.php’,
‘params’ => NULL ),

Then go to the Scheduler page in the backoffice, and add a new job.

Now all your fake spam users will get autodeleted!

8 thoughts on “Automatically remove invalid b2evolution users”

  1. I would like to implement the plugin.
    Where should I add the code:

    ‘delete_users’ => T_(‘Delete invalid users’),

    ‘delete_users’ => array( ‘ctrl’ => ‘cron/_delete_users.job.php’, ‘params’ => NULL ),



  2. Sorry I didn’t make that clearer:

    Edit the file blogs/inc/CONTROL/cron/crontab.php, and find the section that starts with:

    $cron_job_names = array(

    Then add in the new code at the end of the array declaration.
    So it will look like

    $cron_job_names = array(
    [... old stuff ...]
    'delete_users' => T_('Delete invalid users'),

  3. How did you implement email address verification into b2evolution? I want to add it for my site but i can’t find any hacks.

  4. Just for info: after reading your post a few days ago, I’ve added hooks for Plugins that allow this functionality without the need to change any b2evo cor files.

    GetCronJobs() to get the list of provided cron jobs and ExecCronJob() which gets called when the job gets executed.

    This will be available in b2evo 1.9.

  5. I tried to install this cron job with version 1.91 of B2evolution and everything seem OK until i get a message when i configure the task like this : Invalid Task in red..any help would be greatly appreciated :)

  6. Hi, a request. Can you update the plugin to also include a feature that allows auto deletion of users who have not logged into the blog for more than “X” no of days. I want to maintain a clean subscriber base.

Comments are closed.