MyBB Community Forums

Full Version: Delete all the users who doesn't use gmail
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I am trying to delete all the users who doesn't use gmail. How can I do this?

And also how can I only accept gmail users for future?
Query:

DELETE FROM `mybb_users` WHERE `email` NOT LIKE '%@gmail%';
As far as keeping new users from registering from domains other than Gmail go ahead and add the following code to a file in your inc/plugins and call it DomainRestriction.php

<?php
define('THE_DOMAIN', 'gmail.com');

// Registration 
$plugins->add_hook('datahandler_user_validate', 'DomainRestrict_registration');

function DomainRestrict_info(){
    return array(
        "name"            => "Restrict registration",
        "description"    => "",
        "website"        => "https://websupportforum.net",
        "author"        => "R34P3R",
        "authorsite"    => "https://websupportforum.net",
        "guid" => "",
        "version" => "2.0",
        "compatibility" => "16*"
    );
}

function DomainRestrict_registration($data) {
	$email = explode("@", $data->data['email']);
	
	if (strtolower($email[1])!=THE_DOMAIN) {
		$data->set_error('Only users of '.THE_DOMAIN.' may register here.');
	}
}
?>
(2020-10-23, 11:22 PM)R34P3R Wrote: [ -> ]
"compatibility" => "16*"
Really sure your plugin is only for 1.6.x versions ?
Thanks, it solved.
What I did:

DELETE FROM mybb_users WHERE email NOT LIKE '%@gmail%' AND email NOT LIKE '%@hotmail%' AND email NOT LIKE '%@outlook%' AND email NOT LIKE '%@yahoo%' AND email NOT LIKE '%@naver.com' AND email NOT LIKE '%@nate.com' AND email NOT LIKE '%@aol.com%' AND email NOT LIKE '%@icloud%' AND email NOT LIKE '%@comcast%' AND email NOT LIKE '%@protonmail%' AND email NOT LIKE '%@mail.com' AND email NOT LIKE '%@live.com';
(2020-10-28, 07:50 PM)online0227 Wrote: [ -> ]What I did:...

What should i think about it? You said: Only gmail is required.
With your query you almost didn't delete anyone. Big Grin