PHP Method User::delete_user, codiad Code Examples

This page contains top rated real world PHP examples of method User::delete_user from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: delete_user.php Project: CivicCommons/oldBellCaPA
0
                        $message_array[] = $e->message;
                    }
                }
            }
        }
        //deleting user
        try {
            User::delete($user_id);
        } catch (PAException $e) {
            Logger::log('User has been already deleted');
        }
    } else {
        //user delete for network owner
        $network_prefix = $network_info->address;
        try {
            User::delete_user($user_id);
            Network::leave($network_info->network_id, $user_id);
            //network leave
        } catch (PAException $e) {
            $message_array[] = $e->message;
        }
    }
    if ($_GET['msg'] == 'own_delete') {
        $location .= '?msg=7031';
    } else {
        $location .= '?msg=7020';
    }
}
if (count($message_array)) {
    Logger::log('User with user_id = ' . $user_id . ' has been deleted with some errors.' . implode(',', $message_array) . '');
}
Example #2
Show file File: cnfunctions.php Project: Cyberspace-Networks/CoreSystem
0
/**
 * @author   Z.Hron
 * @name     delete_users
 * @brief    This function delete array of users
 * @return   array of error messages
 *
 *
 */
function delete_users($params, $true_delete = FALSE)
{
    $message_array = array();
    $user_id_array = $params['user_id_array'];
    foreach ($user_id_array as $user_id) {
        if (PA::$network_info->type == MOTHER_NETWORK_TYPE) {
            if (!Network::member_exists(PA::$network_info->network_id, (int) $user_id)) {
                $message_array[] = "UserID {$user_id} does not exists.";
                continue;
            }
            //deleting user data from mothership
            try {
                User::delete_user($user_id);
                Activities::delete_for_user($user_id);
            } catch (CNException $e) {
                $message_array[] = $e->message;
            }
            $user_networks = Network::get_user_networks($user_id);
            if (count($user_networks)) {
                foreach ($user_networks as $network) {
                    if ($network->user_type != NETWORK_OWNER) {
                        $network_prefix = $network->address;
                        try {
                            User::delete_user($user_id);
                            Activities::delete_for_user($user_id);
                            Network::leave($network->network_id, $user_id);
                            //leave
                        } catch (CNException $e) {
                            $message_array[] = $e->message;
                        }
                    } else {
                        try {
                            Network::delete($network->network_id);
                        } catch (CNException $e) {
                            $message_array[] = $e->message;
                        }
                    }
                }
            }
            //deleting user
            try {
                User::delete($user_id, $true_delete);
            } catch (CNException $e) {
                Logger::log('User has been already deleted');
            }
        } else {
            //user delete for network owner
            if (!Network::member_exists(PA::$network_info->network_id, (int) $user_id)) {
                $message_array[] = "UserID {$user_id} does not exists.";
                continue;
            }
            $network_prefix = PA::$network_info->address;
            try {
                User::delete_user($user_id);
                Activities::delete_for_user($user_id);
                Network::leave(PA::$network_info->network_id, $user_id);
                //network leave
            } catch (CNException $e) {
                $message_array[] = $e->message;
            }
        }
    }
    return $message_array;
}
Example #3
Show file File: xoa.php Project: phictd/hethongwebhai
0
<?php

require_once '../../../libraries/oop.php';
require_once '../../../libraries/user.php';
$a = new User();
$user = $_GET['id'];
$a->set_user($user);
$a->delete_user();
echo '12';
?>
   
Example #4
Show file File: users.php Project: niceit/tranit-tracker
0
 public function get_delete($user_id)
 {
     User::delete_user($user_id);
     return Redirect::to('administration/users')->with('notice', __('tinyissue.user_deleted'));
 }
Example #5
Show file File: sollicitanten.php Project: samybasset/softjobs
0
                  <div class="item col-md-3"> <!--Begin of one item -->
                  <form method="post"><input type="hidden" name="sollicitantID" value="' . $get_sollicitant['sollicitantID'] . '"><button style="background: none; border: none; position: absolute; top: 2em; right: 2em;"><i class="fa fa-times" aria-hidden="true"></i></button></form>
                    <div class="item-header "><!--Begin of item header shows titel, place and kind of employment  -->
                      <span class="item-titel"><h2>' . $get_sollicitant['voornaam'] . ' ' . $get_sollicitant['achternaam'] . '</h2></span>
                      <div class="item-info">
                        <span><i class="fa fa-map-marker"></i>' . $get_sollicitant['email'] . '</span>
                      </div>
                    </div><!--End of item header -->
                    <div class="expand">
                      <span><a href="edit_sollicitant.php?sollicitantID=' . $_GET['sollicitantID'] . '">Wijzig User</a></span>
                    </div>
                  </div><!--End of one item -->
                  ';
}
if (isset($_POST['sollicitantID'])) {
    $user->delete_user($_POST['sollicitantID']);
    echo '<script>location.href="sollicitanten.php"</script>';
}
?>
              </div>
            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="../js/jquery.js"></script>
Example #6
Show file File: companies.php Project: samybasset/softjobs
0
                  <div class="item col-md-3"> <!--Begin of one item -->
                  <form method="post"><input type="hidden" name="bedrijfID" value="' . $get_company['bedrijfID'] . '"><button style="background: none; border: none; position: absolute; top: 2em; right: 2em;"><i class="fa fa-times" aria-hidden="true"></i></button></form>
                    <div class="item-header "><!--Begin of item header shows titel, place and kind of employment  -->
                      <span class="item-titel"><h2>' . $get_company['bedrijfsnaam'] . '</h2></span>
                      <div class="item-info">
                        <span><i class="fa fa-map-marker"></i>' . $get_company['email'] . '</span>
                      </div>
                    </div><!--End of item header -->
                    <div class="expand">
                      <span><a href="edit_company.php?bedrijfID=' . $_GET['bedrijfID'] . '">Wijzig User</a></span>
                    </div>
                  </div><!--End of one item -->
                  ';
}
if (isset($_POST['bedrijfID'])) {
    $user->delete_user($_POST['bedrijfID']);
    echo '<script>location.href="sollicitanten.php"</script>';
}
?>
              </div>
            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="../js/jquery.js"></script>
Example #7
Show file File: manage_user.php Project: Kylemurray25/wmlmusicguide
0
<?php

include "classes/class.user.php";
if (isset($_GET['action'])) {
    $action = $_GET['action'];
}
if (isset($_GET['ID'])) {
    $id = $_GET['ID'];
}
if ($action == 'edit' && !empty($id)) {
    $user = new User();
    $user->update_user($data);
}
if ($action == 'delete' && !empty($id)) {
    $user = new User();
    //$all_users = $user->get_all_users();
    //print_r($all_users); exit;
    //	$user = new User();
    if ($user->delete_user($id)) {
        header("location: http://wmlmusicguide.com/site/admin/master_admin/viewuser.php?act=deleted");
        exit;
    }
}
//echo $action;
Example #8
Show file File: DeleteUser.php Project: smtsampath/Campaign-Information-System
0
        }
    }
    if ($errmsg == '') {
        function check_input($data)
        {
            $data = trim($data);
            $data = stripslashes($data);
            $data = htmlspecialchars($data);
            $data = mysql_real_escape_string($data);
            return $data;
        }
        $Firstname = check_input($_POST['Firstname']);
        $Lastname = check_input($_POST['Lastname']);
        $Username = check_input($_POST['Username']);
        $userobj = new User();
        if ($userobj->delete_user($Username, $Firstname, $Lastname)) {
            $msg .= 'user Details successfully updated.<br>';
            $Firstname = "";
            $Lastname = "";
            $Username = "";
        } else {
            $errmsg .= '!Opps Some thing went wrong.<br>';
        }
    }
}
include_once "../../includes/dbclose.inc.php";
require_once "../layouts/user_header.php";
?>
		 <!-- Begin lefttcolumn -->
		<div id="leftcolumn">
        <table width="190" border="0">
Example #9
Show file File: users.php Project: pojok-webdev/pattimura
0
 function entry_user_handler()
 {
     $this->check_login();
     $params = $this->input->post();
     if (isset($params['save_x'])) {
         $aktif = isset($params['aktif']) ? '1' : '0';
         $user = new User();
         switch ($params['type']) {
             case 'add':
                 $this->padiauth->create_custom_user($params['username'], $params['password'], $params['email'], $params['group']);
                 $this->access_log->insert_log('Create user ' . $params['username'] . '(' . $params['email'] . ')');
                 redirect(base_url() . 'index.php/back_end/show_user_management/page');
                 break;
             case 'edit':
                 $user->where('id', $params['id'])->update(array('username' => $params['username'], 'email' => $params['email'], 'group_id' => $params['group'], 'status' => $params['aktif']));
                 $this->access_log->insert_log('Edit User ' . $params['username'] . '(' . $params['email'] . ')');
                 if ($params['password'] != '') {
                     $user = new User();
                     $user->where('id', $params['id'])->get();
                     if ($params['password'] == $params['password2']) {
                         $this->padiauth->change_password_user($params['password'], $params['id'], $user->salt);
                         $this->access_log->insert_log('Change password ' . $params['username'] . '(' . $params['email'] . ')');
                         redirect(base_url() . 'index.php/back_end/show_user_management/page');
                     } else {
                         $groups = new Group();
                         $groups->get();
                         $data = array('view_data' => 'entry_user', 'groups' => $groups->get_groups(), 'alert' => 'Password not match', 'type' => 'edit', 'id' => $user->id, 'name' => $user->username, 'email' => $user->email, 'group' => $user->group, 'aktif' => $user->status == '1' ? TRUE : FALSE);
                         $this->access_log->insert_log('Error change password ' . $params['username'] . '(' . $params['email'] . ')');
                         $this->load->view('index', $data);
                     }
                 } else {
                     redirect(base_url() . 'index.php/back_end/show_user_management/page');
                 }
                 break;
         }
     }
     if (isset($params['hapus_member'])) {
         $user = new User();
         $user->where('id', $params['id'])->get();
         foreach ($params['member_id'] as $member_id) {
             echo $member_id;
             $member = new User();
             $member->where('id', $member_id)->get();
             $user->delete_user($member);
             echo $member->username;
         }
         redirect(base_url() . 'index.php/back_end/entry_user/type/edit/id/' . $params['id']);
     }
     if (isset($params['advanced_preference'])) {
         redirect(base_url() . 'index.php/back_end/advanced_user_preferences/id/' . $params['id']);
     }
     if (isset($params['cancel_x'])) {
         redirect(base_url() . 'index.php/back_end/show_user_management/page');
     }
 }
Example #10
Show file File: member.php Project: vodaben/monopoly
0
<?php

require '../database.php';
foreach (glob("../class/*.php", GLOB_NOCHECK) as $filename) {
    require "{$filename}";
}
$user = new User($db);
if (isset($_GET['action'])) {
    if ($_GET['action'] == "delete") {
        $user->delete_user($_GET['uid']);
    }
}
?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Monopoly - Admin Panel</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" href="../css/admin.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</style>
<script src="../js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
</head>
<body>
Example #11
Show file File: user.php Project: par-orillonsoft/elearning-wordpress
0
/**
 * Remove user and optionally reassign posts and links to another user.
 *
 * If the $reassign parameter is not assigned to an User ID, then all posts will
 * be deleted of that user. The action 'delete_user' that is passed the User ID
 * being deleted will be run after the posts are either reassigned or deleted.
 * The user meta will also be deleted that are for that User ID.
 *
 * @since 2.0.0
 *
 * @param int $id User ID.
 * @param int $reassign Optional. Reassign posts and links to new User ID.
 * @return bool True when finished.
 */
function wp_delete_user($id, $reassign = 'novalue')
{
    global $wpdb;
    $id = (int) $id;
    $user = new WP_User($id);
    if (!$user->exists()) {
        return false;
    }
    // allow for transaction statement
    do_action('delete_user', $id);
    if ('novalue' === $reassign || null === $reassign) {
        $post_types_to_delete = array();
        foreach (get_post_types(array(), 'objects') as $post_type) {
            if ($post_type->delete_with_user) {
                $post_types_to_delete[] = $post_type->name;
            } elseif (null === $post_type->delete_with_user && post_type_supports($post_type->name, 'author')) {
                $post_types_to_delete[] = $post_type->name;
            }
        }
        $post_types_to_delete = apply_filters('post_types_to_delete_with_user', $post_types_to_delete, $id);
        $post_types_to_delete = implode("', '", $post_types_to_delete);
        $post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_author = %d AND post_type IN ('{$post_types_to_delete}')", $id));
        if ($post_ids) {
            foreach ($post_ids as $post_id) {
                wp_delete_post($post_id);
            }
        }
        // Clean links
        $link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM {$wpdb->links} WHERE link_owner = %d", $id));
        if ($link_ids) {
            foreach ($link_ids as $link_id) {
                wp_delete_link($link_id);
            }
        }
    } else {
        $reassign = (int) $reassign;
        $post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_author = %d", $id));
        $wpdb->update($wpdb->posts, array('post_author' => $reassign), array('post_author' => $id));
        if (!empty($post_ids)) {
            foreach ($post_ids as $post_id) {
                clean_post_cache($post_id);
            }
        }
        $link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM {$wpdb->links} WHERE link_owner = %d", $id));
        $wpdb->update($wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id));
        if (!empty($link_ids)) {
            foreach ($link_ids as $link_id) {
                clean_bookmark_cache($link_id);
            }
        }
    }
    // FINALLY, delete user
    if (is_multisite()) {
        remove_user_from_blog($id, get_current_blog_id());
    } else {
        $meta = $wpdb->get_col($wpdb->prepare("SELECT umeta_id FROM {$wpdb->usermeta} WHERE user_id = %d", $id));
        $group_user = $_POST['users'];
        //print_r($group_user);
        //exit();
        foreach ($meta as $mid) {
            delete_metadata_by_mid('user', $mid);
        }
        $direct = ABSPATH;
        require_once $direct . '/User.php';
        require_once $direct . '/course.php';
        $user_course = new User();
        $course = new Course();
        foreach ($group_user as $gid) {
            $get_lmsid = "select user_lms from wp_users where ID=" . $gid;
            $getlms = $wpdb->get_row($get_lmsid);
            $res = $user_course->delete_user(1, $getlms->user_lms);
        }
        //echo "hiiiiiiiiiii".$id;
        //exit();
        $wpdb->delete($wpdb->users, array('ID' => $id));
    }
    clean_user_cache($user);
    // allow for commit transaction
    do_action('deleted_user', $id);
    return true;
}
Example #12
Show file File: users.php Project: pjg711/alerta-sondas-detenidas
0
                mensaje("ERROR. No se pudo guardar el nuevo usuario", "", "error");
            }
            break;
        case 'edit':
            if (User::update()) {
                mensaje("El usuario se actualiz\\u00F3 con \\u00E9xito", "Editar usuario");
            } else {
                mensaje("ERROR. No se pudo editar el usuario", "", "error");
            }
            break;
        case 'save_config':
            // guarda la nueva contraseña
            if (User::save_config()) {
                mensaje("Se cambió contraseña de usuario");
            } else {
                mensaje("ERROR. No se pudo cambiar la contraseña.", "", "error");
            }
            break;
        case 'delete_user':
            // borrar usuario
            break;
        case 'confirmed_delete':
            // confirmar borrado de usuario
            if (User::delete_user($userid)) {
                mensaje("El usuario fue borrado", "Borrar usuario");
            } else {
                mensaje("ERROR! No se pudo borrar el usuario", "", "error");
            }
            break;
    }
}