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


PHP UserManager::delete_user方法代码示例

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


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

示例1: delete_inactive_student

 /**
  *
  * @param int   student id
  * @param int   years
  * @param bool  show warning_message
  * @param bool  return_timestamp
  */
 public static function delete_inactive_student($student_id, $years = 2, $warning_message = false, $return_timestamp = false)
 {
     $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $sql = 'SELECT login_date FROM ' . $tbl_track_login . '
             WHERE login_user_id = ' . intval($student_id) . '
             ORDER BY login_date DESC LIMIT 0,1';
     if (empty($years)) {
         $years = 1;
     }
     $inactive_time = $years * 31536000;
     //1 year
     $rs = Database::query($sql);
     if (Database::num_rows($rs) > 0) {
         if ($last_login_date = Database::result($rs, 0, 0)) {
             $last_login_date = api_get_local_time($last_login_date, null, date_default_timezone_get());
             if ($return_timestamp) {
                 return api_strtotime($last_login_date);
             } else {
                 if (!$warning_message) {
                     return api_format_date($last_login_date, DATE_FORMAT_SHORT);
                 } else {
                     $timestamp = api_strtotime($last_login_date);
                     $currentTimestamp = time();
                     //If the last connection is > than 7 days, the text is red
                     //345600 = 7 days in seconds 63072000= 2 ans
                     // if ($currentTimestamp - $timestamp > 184590 )
                     if ($currentTimestamp - $timestamp > $inactive_time && UserManager::delete_user($student_id)) {
                         Display::display_normal_message(get_lang('UserDeleted'));
                         echo '<p>', 'id', $student_id, ':', $last_login_date, '</p>';
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:43,代码来源:usermanager.lib.php

示例2: WSHelperActionOnUsers

function WSHelperActionOnUsers($params, $type)
{
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    $original_user_ids = $params['ids'];
    foreach ($original_user_ids as $original_user_id) {
        $user_id = UserManager::get_user_id_from_original_id($original_user_id['original_user_id_value'], $original_user_id['original_user_id_name']);
        if ($user_id > 0) {
            if ($type == "delete") {
                UserManager::delete_user($user_id);
            } else {
                if ($type == "disable") {
                    UserManager::disable($user_id);
                } else {
                    if ($type == "enable") {
                        UserManager::enable($user_id);
                    }
                }
            }
        }
    }
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:23,代码来源:registration.soap.php

示例3: count

                     } else {
                         $message = Display::return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error');
                     }
                 } else {
                     $message = Display::return_message(get_lang('CannotDeleteUser'), 'error');
                 }
             }
             break;
         case 'delete':
             if (api_is_platform_admin()) {
                 $number_of_selected_users = count($_POST['id']);
                 $number_of_deleted_users = 0;
                 if (is_array($_POST['id'])) {
                     foreach ($_POST['id'] as $index => $user_id) {
                         if ($user_id != $_user['user_id']) {
                             if (UserManager::delete_user($user_id)) {
                                 $number_of_deleted_users++;
                             }
                         }
                     }
                 }
                 if ($number_of_selected_users == $number_of_deleted_users) {
                     $message = Display::return_message(get_lang('SelectedUsersDeleted'), 'confirmation');
                 } else {
                     $message = Display::return_message(get_lang('SomeUsersNotDeleted'), 'error');
                 }
             }
             break;
     }
     Security::clear_token();
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_list.php

示例4: api_not_allowed

<?php

/* For licensing terms, see /license.txt */
//require_once '../inc/global.inc.php';
if (api_get_setting('platform_unsubscribe_allowed') != 'true') {
    api_not_allowed();
}
$tool_name = get_lang('Unsubscribe');
$message = Display::return_message(get_lang('UnsubscribeFromPlatform'), 'warning');
$form = new FormValidator('user_add');
$form->addElement('button', 'submit', get_lang('Unsubscribe'), array('onclick' => "javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang("UnsubscribeFromPlatformConfirm"))) . "')) return false;"));
$content = $form->returnForm();
if ($form->validate()) {
    $user_info = api_get_user_info();
    $result = UserManager::delete_user($user_info['user_id']);
    if ($result) {
        $message = Display::return_message(sprintf(get_lang('UnsubscribeFromPlatformSuccess', $user_info['username'])));
        $content = null;
        online_logout($user_info['user_id'], false);
        api_not_allowed(true, $message);
    }
}
//$tpl = new Template($tool_name);
echo $actions;
echo $message;
echo $content;
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:26,代码来源:unsubscribe_account.php

示例5: transaction_2

 static function transaction_2($data)
 {
     $uidIdPersonaId = strtoupper($data['item_id']);
     global $data_list;
     $user_id = self::get_user_id_by_persona_id($uidIdPersonaId, $data_list);
     if ($user_id) {
         $chamilo_user_info_before = api_get_user_info($user_id, false, false, true);
         $result = UserManager::delete_user($user_id);
         $chamilo_user_info = api_get_user_info($user_id, false, false, true);
         if ($result) {
             $data_list['users'][$uidIdPersonaId] = null;
             return array('entity' => 'user', 'before' => $chamilo_user_info_before, 'after' => $chamilo_user_info, 'message' => "User was deleted : {$user_id}", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
         } else {
             return array('message' => "User was NOT deleted : {$user_id} error while calling function UserManager::delete_user", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
         }
     } else {
         return array('message' => "User was not found with uidIdPersona: {$uidIdPersonaId}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:19,代码来源:migration.custom.class.php

示例6: deleteUserHelper

 /**
  * Deletes a user (helper method)
  *
  * @param string User id field name. Use "chamilo_user_id" as the field name if you want to use the internal user_id
  * @param string User id value
  * @return mixed True if user was successfully deleted, WSError otherwise
  */
 protected function deleteUserHelper($user_id_field_name, $user_id_value)
 {
     $user_id = $this->getUserId($user_id_field_name, $user_id_value);
     if ($user_id instanceof WSError) {
         return $user_id;
     } else {
         if (!UserManager::delete_user($user_id)) {
             return new WSError(101, "There was a problem while deleting this user");
         } else {
             return true;
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:20,代码来源:webservice_user.php

示例7: testDelete_user2

 /**
  * @depends testCreateUser
  */
 public function testDelete_user2()
 {
     $user_info = UserManager::get_user_info('jmontoya666');
     $this->assertSame(false, UserManager::delete_user($user_info['user_id']));
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:UserManagerTest.lib.php


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