group think

<?php
db_set_active('mtga');
$result=db_query("select uid from users where uid > 1");
db_set_active();

while ($user = db_fetch_object($result)) {
db_set_active('mtga');
$roles = db_query("select * from users_roles where uid=%d",$user->uid);
db_set_active();

$active=false;
while ($role = db_fetch_array($roles)) {
if ($role['rid']>2) $active=true;
}

if (!$active) {
$newUID = db_result(db_query("select newID from artistworks_migration where oldID=%d and type='user' and site='mtga'",$user->uid));
echo 'delete '.$newUID.'
used to be '.$user->uid.'
';
$hasRole = db_result(db_query("select rid from users_roles where uid=%d",$newUID));
if ($hasRole) echo ' !!! and has role '.$hasRole.'
';
//og_delete_subscription(7205,$newUID);
}
}
?>