Esempio n. 1
0
function _deleteUser($user)
{
    $retVal = true;
    echo "<br> {$username} is now going to be deleted from vLab!";
    if (deleteQSUser($user)) {
        echo "<br> deleteQSUser for {$user->username} was successful.";
        if (deleteUserProfile('admin', $user)) {
            echo "<br> deleteUserProfile for {$user->username} was successful.";
            if (delete_user($user)) {
                echo "<br> delete_user for {$user->username} was successful.";
                echo "<br> {$user->username} was successfully deleted from vLab.";
                send_user_deleted_notification($user);
            } else {
                echo "<br> Error occurred in delete_user while trying delete {$username} from vLab.";
                admin_moodlefailed_email($user, 'deleteUser');
                $retVal = false;
            }
        } else {
            addQSUser($user);
            // re-Adds the user to the QS if second WS call fails
            echo "<br> Error occurred in deleteUserProfile while trying delete {$username} from vLab.";
            admin_webservicefailed_email($user, 'deleteUser');
            $retVal = false;
        }
    } else {
        echo "<br> Error occurred in deleteQSUser while trying delete {$username} from vLab.";
        admin_moodlefailed_email($user, 'deleteUser');
        $retVal = false;
    }
    return $retVal;
}
Esempio n. 2
0
 }
 if (is_primary_admin($user->id)) {
     error("You are not allowed to delete the primary admin user!", '', true);
 }
 if ($confirm != md5($delete)) {
     $fullname = fullname($user, true);
     print_heading(get_string('deleteuser', 'admin'));
     $optionsyes = array('delete' => $delete, 'confirm' => md5($delete), 'sesskey' => sesskey());
     notice_yesno(get_string('deletecheckfull', '', "'{$fullname}'"), 'user.php', 'user.php', $optionsyes, NULL, 'post', 'get');
     admin_externalpage_print_footer();
     die;
 } else {
     if (data_submitted() and !$user->deleted) {
         // Added: to call calendar ws to delete user, if fails then dont delete
         // Added: 01.03.2010 - quotasystem.php
         if (deleteQSUser($user)) {
             if (deleteUserProfile($USER->username, $user)) {
                 if (delete_user($user)) {
                     notify(get_string('deletedactivity', '', fullname($user, true)));
                 } else {
                     notify(get_string('deletednot', '', fullname($user, true)));
                     admin_moodlefailed_email($user, 'deleteUser');
                 }
             } else {
                 addQSUser($user);
                 // re-Adds the user to the QS if second WS call fails
                 admin_webservicefailed_email($user, 'deleteUser');
                 notify(get_string('deletednot', '', fullname($user, true)));
             }
         } else {
             //error('This account could not be deleted.');