Activate awaiting validation users to members
I have a group of people who have yet to validate their email(Users Awaiting Validation), however, I want to activate them to Members, can it be done ?

I know I can activate them by AdminCP, but theres 100 of them...can it be done by MySQL query instead?
upload this the root of the board, and execute it.


Attached Files
.php   act_all.php (Size: 490 bytes / Downloads: 81)
Most of the time that will work, but maybe sometimes the 'oldgroup' is not the registered usergroup.

Modified the code:

require "./global.php";

$query = $db->query("
	SELECT u.uid, u.usergroup, a.oldgroup
	FROM ".TABLE_PREFIX."users u 
		LEFT JOIN ".TABLE_PREFIX."awaitingactivation a ON (u.uid=a.uid)
	WHERE u.usergroup='5'");
while($ex = $db->fetch_array($query))
		$ex['oldgroup'] = 2;
	$del = $db->query("UPDATE ".TABLE_PREFIX."users SET usergroup ='".$ex['oldgroup']."' WHERE uid='".$ex['uid']."'");
	$clean_ac = $db->query("DELETE FROM ".TABLE_PREFIX."awaitingactivation WHERE uid='".$ex['uid']."'");
if($del && $clean_ac)
	echo "<h1>DONE!</h1>";
	echo "<h1>A problem occurred</h1>";

Dennis Tsang
Former MyBB Team Member
It would be nice in the admincp there was "bulk" selections.

Forum Jump:

Users browsing this thread: 1 Guest(s)