MyBB Community Forums
Delete all the users who doesn't use gmail - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: Delete all the users who doesn't use gmail (/thread-229889.html)



Delete all the users who doesn't use gmail - online0227 - 2020-10-21

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?


RE: Delete all the users who doesn't use gmail - Schnapsnase - 2020-10-22

Query:

DELETE FROM `mybb_users` WHERE `email` NOT LIKE '%@gmail%';



RE: Delete all the users who doesn't use gmail - R34P3R - 2020-10-23

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.');
	}
}
?>



RE: Delete all the users who doesn't use gmail - Crazycat - 2020-10-25

(2020-10-23, 11:22 PM)R34P3R Wrote:
"compatibility" => "16*"
Really sure your plugin is only for 1.6.x versions ?


RE: Delete all the users who doesn't use gmail - online0227 - 2020-10-28

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';


RE: Delete all the users who doesn't use gmail - Schnapsnase - 2020-10-28

(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