[HOW-TO] Remove a huge array of users

Code-talk. Anything related to the Studio, extension developing and phpBB coding.


Post Reply
User avatar
3Di
Founder
Founder
Posts: 1851
Joined: 12 Mar 2018 20:10
Location: Milan (IT) Frankfurt (DE)
Contact:

[HOW-TO] Remove a huge array of users

Post by 3Di »

Create a PHP file and put it in the root of your board then execute it

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

// Array of user IDs - example [4,5,6,9,12,100]
// You have to have to provide this array!
$user_ids = [];

foreach ($user_ids as $user_id)
{
	// Note: the whole function is done within a SQL transaction.
	user_delete('remove', $user_id, false);
}

echo 'Done!';

🇪🇺 Honour and respect to all the Healthcare Heroes. 🇮🇹


User avatar
3Di
Founder
Founder
Posts: 1851
Joined: 12 Mar 2018 20:10
Location: Milan (IT) Frankfurt (DE)
Contact:

[HOW-TO] Remove a huge array of users

Post by 3Di »

Fixed the above code, I wrote it on the fly and a semicolon was missing. Sorry.

🇪🇺 Honour and respect to all the Healthcare Heroes. 🇮🇹


Post Reply