当前位置: 首页>>代码示例>>PHP>>正文


PHP UserModel::delete方法代码示例

本文整理汇总了PHP中UserModel::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::delete方法的具体用法?PHP UserModel::delete怎么用?PHP UserModel::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserModel的用法示例。


在下文中一共展示了UserModel::delete方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete()
 {
     $id = request('id');
     if (!$id) {
         $this->error('缺少ID');
     }
     if (UserModel::delete($id)) {
         $this->success('/admin/user');
     } else {
         $this->error('操作失败');
     }
 }
开发者ID:BGCX261,项目名称:zhflash-svn-to-git,代码行数:12,代码来源:user.php

示例2: user_model_test

function user_model_test($delete)
{
    $user = new UserModel("Not", "Here", "not.here@nowhere.com", "password", date("Y-m-d H:i:s"));
    $user->save();
    $user->print_fields();
    $user->set("failed_login_attempts", 3);
    $user->set("first_name", "User");
    $user->set("last_name", "McUsage");
    $user->save();
    $user->print_fields();
    if ($delete) {
        $user->delete();
    }
    $um = UserModel::find(UserModel::first()->id);
    $um->print_fields();
    $um = UserModel::find(UserModel::last()->id);
    $um->print_fields();
    UserModel::find(999);
}
开发者ID:spencerbartz,项目名称:horrie_international,代码行数:19,代码来源:user_model.php

示例3: delete

 /**
  * Delete a user account.
  *
  * @since 2.0.0
  * @access public
  * @param int $UserID Unique ID.
  * @param string $Method Type of deletion to do (delete, keep, or wipe).
  */
 public function delete($UserID = '', $Method = '')
 {
     $this->permission('Garden.Users.Delete');
     $Session = Gdn::session();
     if ($Session->User->UserID == $UserID) {
         trigger_error(errorMessage("You cannot delete the user you are logged in as.", $this->ClassName, 'FetchViewLocation'), E_USER_ERROR);
     }
     $this->addSideMenu('dashboard/user');
     $this->title(t('Delete User'));
     $RoleModel = new RoleModel();
     $AllRoles = $RoleModel->getArray();
     // By default, people with access here can freely assign all roles
     $this->RoleData = $AllRoles;
     $UserModel = new UserModel();
     $this->User = $UserModel->getID($UserID);
     try {
         $CanDelete = true;
         $this->EventArguments['CanDelete'] =& $CanDelete;
         $this->EventArguments['TargetUser'] =& $this->User;
         // These are all the 'effective' roles for this delete action. This list can
         // be trimmed down from the real list to allow subsets of roles to be
         // edited.
         $this->EventArguments['RoleData'] =& $this->RoleData;
         $UserRoleData = $UserModel->getRoles($UserID)->resultArray();
         $RoleIDs = array_column($UserRoleData, 'RoleID');
         $RoleNames = array_column($UserRoleData, 'Name');
         $this->UserRoleData = ArrayCombine($RoleIDs, $RoleNames);
         $this->EventArguments['UserRoleData'] =& $this->UserRoleData;
         $this->fireEvent("BeforeUserDelete");
         $this->setData('CanDelete', $CanDelete);
         $Method = in_array($Method, array('delete', 'keep', 'wipe')) ? $Method : '';
         $this->Method = $Method;
         if ($Method != '') {
             $this->View = 'deleteconfirm';
         }
         if ($this->Form->authenticatedPostBack() && $Method != '') {
             $UserModel->delete($UserID, array('DeleteMethod' => $Method));
             $this->View = 'deletecomplete';
         }
     } catch (Exception $Ex) {
         $this->Form->addError($Ex);
     }
     $this->render();
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:52,代码来源:class.usercontroller.php

示例4: users_delete

 /**
  * Deletes a user identified in the 'params' parameter
  *
  * @global Array $STRINGS
  * @param Array $params
  */
 public function users_delete($params)
 {
     global $STRINGS;
     $result = false;
     if (isset($params[0])) {
         // delete the user data
         $op1 = UserModel::delete($params[0]);
         // delete the user activity
         $op2 = ActivityModel::delete_all_by_user($params[0]);
         $result = $op1 && $op2;
     }
     $result == true ? $alert = BootstrapHelper::alert('success', $STRINGS['event:success'], $STRINGS['user:delete:success']) : ($alert = BootstrapHelper::alert('error', $STRINGS['event:error'], $STRINGS['user:delete:failed']));
     $this->_data->page = 0;
     $this->_data->users = UserModel::find_page(0);
     new AdminUsersView($this->_data, $alert);
 }
开发者ID:robertboloc,项目名称:presence-manager,代码行数:22,代码来源:AdminController.php

示例5: delete

 public function delete($id = null)
 {
     $this->load->model('UserModel');
     $user = new UserModel();
     if ($this->isLogged()) {
         switch ($this->session->userdata('role')) {
             case '1':
                 if ($this->session->userdata('userid') == $id) {
                     redirect(base_url('user/index/3'));
                 } else {
                     if ($user->delete($id)) {
                         redirect(base_url('user/index/4'));
                     }
                 }
                 break;
             case '2':
                 $this->load->view('public/norole');
                 break;
         }
     }
 }
开发者ID:asvinicius,项目名称:ccb,代码行数:21,代码来源:User.php

示例6: del

 public function del()
 {
     $user_id = I('id', 0);
     if (0 < $user_id) {
         $user = new UserModel();
         if (false !== $user->delete($user_id)) {
             $this->message('操作成功', __URL__ . '/index');
         } else {
             $this->message('操作失败:' . $user->getDbError());
         }
     } else {
         $this->message('请选择删除用户', __URL__ . '/index');
     }
 }
开发者ID:kwdwkiss,项目名称:kongbao8,代码行数:14,代码来源:UserAction.class.php

示例7: delete

 function delete()
 {
     // Refuse to delete a user with tickets
     if ($this->tickets->count()) {
         return false;
     }
     // Delete account record (if any)
     if ($this->getAccount()) {
         $this->getAccount()->delete();
     }
     // Delete emails.
     $this->emails->expunge();
     // Drop dynamic data
     foreach ($this->getDynamicData() as $cd) {
         $cd->delete();
     }
     // Delete user
     return parent::delete();
 }
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:19,代码来源:class.user.php

示例8: del

 /**
  * 删除用户
  */
 function del()
 {
     $del_id = $_POST['del_id'];
     $ids = implode($del_id, ',');
     //实例化
     $users = new UserModel();
     if ($users->delete($ids)) {
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->success('用户删除成功');
     } else {
         $this->assign('jumpUrl', __URL__ . '/index');
         $this->error('更新失败!!!' . $users->getDbError());
     }
 }
开发者ID:omusico,项目名称:AndyCMS,代码行数:17,代码来源:UserAction.class.php

示例9: header

        // TODO: data validation
        // populate input from user
        $user->setId($_POST['id']);
        $user->setFirstName($_POST['first_name']);
        $user->setLastName($_POST['last_name']);
        $user->setUsername($_POST['username']);
        $user->setPassword($_POST['password']);
        // update database
        if ($userModel->update($user)) {
            header('location:../index.php?action=edit&status=success');
        } else {
            // TODO: populate last inputs to session
            // return back to form : no rows affected
            // header('location:../form.php?action=edit&id='.$_POST['id'].'&status=failed');
            header('location:../index.php?action=edit&status=success');
        }
        break;
    case 'delete':
        // populate input from user
        $user->setId($_POST['id']);
        // delete from database
        if ($userModel->delete($user)) {
            header('location:../index.php?action=delete&status=success');
        } else {
            header('location:../index.php?action=delete&status=failed');
        }
        break;
    default:
        header('location:../index.php');
        break;
}
开发者ID:anggadarkprince,项目名称:php-pdo-mysqli,代码行数:31,代码来源:user.php

示例10: delete

 function delete()
 {
     // Refuse to delete a user with tickets
     if ($this->tickets->count()) {
         return false;
     }
     // Delete account record (if any)
     if ($this->getAccount()) {
         $this->getAccount()->delete();
     }
     // Delete emails.
     $this->emails->expunge();
     // Delete user
     return parent::delete();
 }
开发者ID:ed00m,项目名称:osTicket-1.8,代码行数:15,代码来源:class.user.php

示例11: handleDeleteUser

 function handleDeleteUser($id)
 {
     UserModel::delete($id);
     $this['userTabella']->invalidateControl();
 }
开发者ID:oaki,项目名称:demoshop,代码行数:5,代码来源:Admin_User.php

示例12: testDelete

 /**
  * Tests the delete method
  */
 public function testDelete()
 {
     //create fake user
     $user = new stdClass();
     $user->id = '999997';
     $user->identifier = 'tester3';
     //store the fake user
     UserModel::create($user);
     //delete the fake user
     UserModel::delete('999997');
     //check that the user is gone
     $this->assertFalse(UserModel::find('999997'));
 }
开发者ID:robertboloc,项目名称:presence-manager,代码行数:16,代码来源:ModelTest.php

示例13: delUser

 public function delUser($id)
 {
     return $this->userDao->delete(['id' => $id]);
 }
开发者ID:loncool,项目名称:yaf-admin,代码行数:4,代码来源:Manage.php


注:本文中的UserModel::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。