Mass User Delete Print

  • 5

Code for mass deletion of users in old database.  Create a text file containing an id in each row, which would be pulled during operation.

include('models/user.php');
$model = new UsersModelUser();
if( $fh = fopen(dirname(__FILE__).'/DeleteList.txt', 'r') ){
  while( $id = fgets($fh) ){
    if( strpos($id, '#') === false && (int)$id ){
      $id = (int)$id;
      $user = JUser::getInstance($id);
      if( $user->id ){
        echo 'Removing: '.$id.'
';
        $model->delete($id);
        flush();usleep(10000);
      }
    }
  }
}


Was this answer helpful?

« Back