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


PHP user_delete函数代码示例

本文整理汇总了PHP中user_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP user_delete函数的具体用法?PHP user_delete怎么用?PHP user_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testRolePurchaseCheckout

 public function testRolePurchaseCheckout()
 {
     // Add role assignment to the test product.
     $rid = $this->drupalCreateRole(array('access content'));
     $this->drupalLogin($this->adminUser);
     $this->drupalPostForm('node/' . $this->product->id() . '/edit/features', array('feature' => 'role'), t('Add'));
     $edit = array('role' => $rid, 'end_override' => TRUE, 'expire_relative_duration' => 1, 'expire_relative_granularity' => 'day');
     $this->drupalPostForm(NULL, $edit, t('Save feature'));
     // Check out with the test product.
     $method = $this->createPaymentMethod('other');
     $this->addToCart($this->product);
     $order = $this->checkout();
     uc_payment_enter($order->id(), $method['id'], $order->getTotal());
     // Test that the role was granted.
     // @todo Re-enable when Rules is available.
     // $this->assertTrue($order->getOwner()->hasRole($rid), 'Existing user was granted role.');
     // Test that the email is correct.
     $role = Role::load($rid);
     // @todo Re-enable when Rules is available.
     // $this->assertMailString('subject', $role->label(), 4, 'Role assignment email mentions role in subject line.');
     // Test that the role product / user relation is deleted with the user.
     user_delete($order->getOwnerId());
     // Run cron to ensure deleted users are handled correctly.
     $this->cronRun();
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:25,代码来源:RoleTest.php

示例2: update_bots

    public function update_bots()
    {
        // Update bots
        if (!function_exists('user_delete')) {
            include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
        }
        $bots_updates = array('NG-Search [Bot]' => false, 'Nutch/CVS [Bot]' => false, 'OmniExplorer [Bot]' => false, 'Seekport [Bot]' => false, 'Synoo [Bot]' => false, 'WiseNut [Bot]' => false, 'Baidu [Spider]' => 'Baiduspider', 'Exabot [Bot]' => 'Exabot', 'Voyager [Bot]' => 'voyager/', 'W3C [Validator]' => 'W3C_Validator');
        foreach ($bots_updates as $bot_name => $bot_agent) {
            $sql = 'SELECT user_id
				FROM ' . USERS_TABLE . '
				WHERE user_type = ' . USER_IGNORE . "\n\t\t\t\t\tAND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'";
            $result = $this->db->sql_query($sql);
            $bot_user_id = (int) $this->db->sql_fetchfield('user_id');
            $this->db->sql_freeresult($result);
            if ($bot_user_id) {
                if ($bot_agent === false) {
                    $sql = 'DELETE FROM ' . BOTS_TABLE . "\n\t\t\t\t\t\tWHERE user_id = {$bot_user_id}";
                    $this->sql_query($sql);
                    user_delete('retain', $bot_user_id);
                } else {
                    $sql = 'UPDATE ' . BOTS_TABLE . "\n\t\t\t\t\t\tSET bot_agent = '" . $this->db->sql_escape($bot_agent) . "'\n\t\t\t\t\t\tWHERE user_id = {$bot_user_id}";
                    $this->sql_query($sql);
                }
            }
        }
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:26,代码来源:bot_update.php

示例3: deleteUsers

 /**
  * Deletes a given list of users.
  *
  * @param array $uids
  *   An indexed array of user IDs to delete.
  */
 protected function deleteUsers(array $uids = array())
 {
     foreach ($uids as $uid) {
         $this->reassignFiles($uid);
         user_delete($uid);
     }
 }
开发者ID:robtryson,项目名称:nysits,代码行数:13,代码来源:AcsfDuplicationScrubUserHandler.php

示例4: testFilePurchaseCheckout

 public function testFilePurchaseCheckout()
 {
     // Add file download feature to the test product.
     $filename = $this->getTestFile();
     $this->drupalLogin($this->adminUser);
     $this->drupalPostForm('node/' . $this->product->id() . '/edit/features', array('feature' => 'file'), t('Add'));
     $edit = array('uc_file_model' => '', 'uc_file_filename' => $filename);
     $this->drupalPostForm(NULL, $edit, t('Save feature'));
     // Check out with the test product.
     $method = $this->createPaymentMethod('other');
     $this->addToCart($this->product);
     $order = $this->checkout();
     uc_payment_enter($order->id(), $method['id'], $order->getTotal());
     // Test that the file was granted.
     // @todo Re-enable when Rules is available.
     // $this->assertTrue($order->getUser()->hasFile($filename), 'Existing user was granted file.');
     // Test that the email is correct.
     //    $file = entity_load('user_file', $fid);
     // @todo Re-enable when Rules is available.
     // $this->assertMailString('subject', $file->label(), 4, 'File assignment email mentions file in subject line.');
     // Delete the user.
     user_delete($order->getOwnerId());
     // Run cron to ensure deleted users are handled correctly.
     $this->cronRun();
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:25,代码来源:FileTest.php

示例5: bots

    /**
     * Reset all bots
     */
    function bots($error)
    {
        global $config, $db;
        if (isset($_POST['yes'])) {
            $sql = 'SELECT group_id, group_colour
				FROM ' . GROUPS_TABLE . "\n\t\t\t\tWHERE group_name = 'BOTS'";
            $result = $db->sql_query($sql);
            $group_id = (int) $db->sql_fetchfield('group_id', false, $result);
            $group_colour = $db->sql_fetchfield('group_colour', 0, $result);
            $db->sql_freeresult($result);
            if (!$group_id) {
                // If we reach this point then something has gone very wrong
                $error[] = 'NO_BOT_GROUP';
                return $error;
            } else {
                if (!function_exists('user_add')) {
                    include PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
                }
                // Remove existing bots
                $uids = array();
                $sql = 'SELECT user_id FROM ' . BOTS_TABLE;
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $uids[] = $row['user_id'];
                }
                $db->sql_freeresult($result);
                if (!empty($uids)) {
                    // Remove all the bots
                    foreach ($uids as $uid) {
                        user_delete('remove', $uid);
                    }
                    // Clear out the bots table
                    $db->sql_query('DELETE FROM ' . BOTS_TABLE);
                }
                // Add the bots
                foreach ($this->db_cleaner->data->bots as $bot_name => $bot_ary) {
                    /* Clean the users table of any bots matching this...
                     * this is an issue if a default bot was removed from the bots group. */
                    $username_clean = utf8_clean_string($bot_name);
                    if (empty($username_clean)) {
                        // This shouldn't happen but we should handle it anyway...
                        continue;
                    }
                    $sql = 'DELETE FROM ' . USERS_TABLE . ' WHERE username_clean = \'' . $db->sql_escape($username_clean) . '\'';
                    $db->sql_query($sql);
                    // `$bot_ary` can be false, if a bot was removed in a certain phpBB version
                    if ($bot_ary === false) {
                        continue;
                    }
                    $user_row = array('user_type' => USER_IGNORE, 'group_id' => $group_id, 'username' => $bot_name, 'user_regdate' => time(), 'user_password' => '', 'user_colour' => $group_colour, 'user_email' => '', 'user_lang' => $config['default_lang'], 'user_style' => 1, 'user_timezone' => 0, 'user_dateformat' => $config['default_dateformat'], 'user_allow_massemail' => 0);
                    $user_id = user_add($user_row);
                    if ($user_id) {
                        $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array('bot_active' => 1, 'bot_name' => (string) $bot_name, 'user_id' => (int) $user_id, 'bot_agent' => (string) $bot_ary[0], 'bot_ip' => (string) $bot_ary[1]));
                        $result = $db->sql_query($sql);
                    }
                }
            }
        }
    }
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:62,代码来源:database_cleaner_controller.php

示例6: hook_mandrill_mailsend_result

/**
 * Allow other modules to respond to the result of sending an email.
 *
 * @param array $result
 *   Associative array containing the send result, including the status.
 */
function hook_mandrill_mailsend_result($result)
{
    if ($result['status'] == 'rejected') {
        // Delete user.
        $user = user_load_by_mail($result['email']);
        user_delete($user->uid);
    }
}
开发者ID:isaenkov,项目名称:Dru.io,代码行数:14,代码来源:mandrill.api.php

示例7: user_delete_unwanted

 function user_delete_unwanted()
 {
     db_delete('user', '(`authorized`=0) AND (`timestamp`<=' . time() - config_get('confirm_authorize_timeout') . ')');
     $q = db_select('user', array('id'), '(`last_act`>0) AND (`last_act`<' . (time() - config_get('user-lifetime')) . ') AND (`id`!=1)');
     while ($r = db_row($q)) {
         user_delete($r['id']);
     }
 }
开发者ID:Nazg-Gul,项目名称:gate,代码行数:8,代码来源:user.php

示例8: delete_contact

function delete_contact()
{
    if (check_rights('delete_contact')) {
        $user_id = $_GET['contact'];
        user_delete('retain', $user_id);
        header("location: /manager.php?action=list_contacts");
        return $html;
    } else {
        return "Нет соответствующих прав.<br/>";
    }
}
开发者ID:jsib,项目名称:intranet,代码行数:11,代码来源:delete_contact.php

示例9: user_merge

/**
 * Merge two user accounts into one
 *
 * @author eviL3
 * @param int $old_user User id of the old user
 * @param int $new_user User id of the new user
 *
 * @return void
 */
function user_merge($old_user, $new_user)
{
    global $user, $db;
    if (!function_exists('user_add')) {
        global $phpbb_root_path, $phpEx;
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
    }
    $old_user = (int) $old_user;
    $new_user = (int) $new_user;
    // Update postcount
    $total_posts = 0;
    // Add up the total number of posts for both...
    $sql = 'SELECT user_posts
		FROM ' . USERS_TABLE . '
		WHERE ' . $db->sql_in_set('user_id', array($old_user, $new_user));
    $result = $db->sql_query($sql);
    while ($return = $db->sql_fetchrow($result)) {
        $total_posts = $total_posts + (int) $return['user_posts'];
    }
    $db->sql_freeresult($result);
    // Now set the new user to have the total amount of posts.  ;)
    $db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array('user_posts' => $total_posts)) . ' WHERE user_id = ' . $new_user);
    // Get both users userdata
    $data = array();
    foreach (array($old_user, $new_user) as $key) {
        $sql = 'SELECT user_id, username, user_colour
			FROM ' . USERS_TABLE . '
				WHERE user_id = ' . $key;
        $result = $db->sql_query($sql);
        $data[$key] = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
    }
    $update_ary = array(ATTACHMENTS_TABLE => array('poster_id'), FORUMS_TABLE => array(array('forum_last_poster_id', 'forum_last_poster_name', 'forum_last_poster_colour')), LOG_TABLE => array('user_id', 'reportee_id'), MODERATOR_CACHE_TABLE => array(array('user_id', 'username')), POSTS_TABLE => array(array('poster_id', 'post_username'), 'post_edit_user'), POLL_VOTES_TABLE => array('vote_user_id'), PRIVMSGS_TABLE => array('author_id', 'message_edit_user'), PRIVMSGS_TO_TABLE => array('user_id', 'author_id'), REPORTS_TABLE => array('user_id'), TOPICS_TABLE => array(array('topic_poster', 'topic_first_poster_name', 'topic_first_poster_colour'), array('topic_last_poster_id', 'topic_last_poster_name', 'topic_last_poster_colour')));
    foreach ($update_ary as $table => $field_ary) {
        foreach ($field_ary as $field) {
            $sql_ary = array();
            if (!is_array($field)) {
                $field = array($field);
            }
            $sql_ary[$field[0]] = $new_user;
            if (!empty($field[1])) {
                $sql_ary[$field[1]] = $data[$new_user]['username'];
            }
            if (!empty($field[2])) {
                $sql_ary[$field[2]] = $data[$new_user]['user_colour'];
            }
            $primary_field = $field[0];
            $sql = "UPDATE {$table} SET " . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\tWHERE {$primary_field} = {$old_user}";
            $db->sql_query($sql);
        }
    }
    user_delete('remove', $old_user);
}
开发者ID:phpbbmodders-30x-mods,项目名称:modders-libs,代码行数:62,代码来源:functions_user_merge.php

示例10: main

 public function main($id, $mode)
 {
     global $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
     global $request, $phpbb_container, $phpbb_log;
     $user->add_lang_ext('jv/deletemyregistration', 'ucp');
     $error = array();
     $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
     $delete_acc = $request->variable('delete_acc', false, false, \phpbb\request\request_interface::POST);
     $delete_post = $request->variable('delete_post', false, false, \phpbb\request\request_interface::POST) && $auth->acl_get('u_my_acc_post_delete') ? true : false;
     $user_password = $request->variable('user_password', '', true);
     add_form_key('my_acc_delete');
     if ($submit) {
         if (!check_form_key('my_acc_delete')) {
             $error[] = 'FORM_INVALID';
         }
         if (!$delete_acc) {
             $error[] = 'MY_ACC_DELETE_CONFIRM_ERROR';
         }
         if ($user->data['user_type'] == USER_FOUNDER) {
             $error[] = 'MY_ACC_DELETE_FOUNDER_ERROR';
         }
         // Instantiate passwords manager
         $passwords_manager = $phpbb_container->get('passwords.manager');
         if (!$passwords_manager->check($user_password, $user->data['user_password'])) {
             $error[] = 'CUR_PASSWORD_ERROR';
         }
         if (!sizeof($error) && $submit) {
             $delete_type = $delete_post ? 'remove' : 'retain';
             $log_type = $delete_post ? 'LOG_MY_ACC_POST_DELETE' : 'LOG_MY_ACC_DELETE';
             $additional_data = array('reportee_id' => 0, $user->data['username']);
             $phpbb_log->add('user', ANONYMOUS, $user->ip, $log_type, time(), $additional_data);
             user_delete($delete_type, $user->data['user_id'], $user->data['username']);
             meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx));
             trigger_error('MY_ACC_DELETE_SUCCESS');
         }
         // Replace "error" strings with their real, localised form
         $error = array_map(array($user, 'lang'), $error);
     }
     $template->assign_vars(array('S_ERROR' => sizeof($error) ? true : false, 'S_DELETE_MY_POST' => $auth->acl_get('u_my_acc_post_delete') ? true : false, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'CONFIRM_CHECKED' => $delete_acc ? ' checked="checked"' : '', 'POST_CHECKED' => $delete_post ? ' checked="checked"' : ''));
     // Set desired template
     $this->tpl_name = 'ucp_profile_' . $mode;
     $this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
 }
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:43,代码来源:delete_my_registration_module.php

示例11: ucp_profile_reg_details_data

 /**
  * Delete the user
  *
  * @param type $event
  */
 public function ucp_profile_reg_details_data($event)
 {
     $this->user->add_lang(array('acp/common', 'acp/users'));
     $delete_type = request_var('delete_type', '');
     $this->template->assign_vars(array('AUTH_DELETE_POSTS' => $this->auth->acl_get('u_self_delete_posts') ? true : false));
     if ($event['submit'] && $delete_type) {
         if ($this->user->data['user_type'] == USER_FOUNDER) {
             $this->error[] = 'CANNOT_REMOVE_FOUNDER';
         }
         if (!sizeof($this->error)) {
             if (confirm_box(true)) {
                 $delete_type = $this->auth->acl_get('u_self_delete_posts') ? $delete_type : 'remove';
                 user_delete($delete_type, $this->user->data['user_id'], $this->user->data['username']);
                 add_log('admin', 'LOG_USER_DELETED', $this->user->data['username']);
                 trigger_error($this->user->lang['USER_DELETED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . generate_board_url() . '">', '</a>'));
             } else {
                 confirm_box(false, $this->user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('delete' => 1, 'form_token' => $this->request->variable('form_token', ''), 'submit' => true, 'cur_password' => $this->request->variable('cur_password', '', true), 'delete_type' => $delete_type)));
             }
         }
     }
 }
开发者ID:rinsrans,项目名称:phpBB-selfdelete,代码行数:26,代码来源:listener.php

示例12: test_user_delete

    public function test_user_delete()
    {
        // Check that user is linked
        $sql = 'SELECT ot.user_id AS user_id
			FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot
			WHERE oa.user_id = 2
				AND ot.user_id = oa.user_id';
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        $this->assertEquals(array('user_id' => '2'), $row);
        // user_delete() should return false
        $this->assertFalse(user_delete('remove', array(2)));
        // Make sure user link was removed
        $sql = 'SELECT ot.user_id AS user_id
			FROM phpbb_oauth_accounts oa, phpbb_oauth_tokens ot
			WHERE oa.user_id = 2
				AND ot.user_id = oa.user_id';
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        $this->assertEmpty($row);
    }
开发者ID:ZerGabriel,项目名称:phpbb,代码行数:23,代码来源:user_delete_test.php

示例13: main


//.........这里部分代码省略.........
			case 'overview':

				include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

				$user->add_lang('acp/ban');

				$delete			= request_var('delete', 0);
				$delete_type	= request_var('delete_type', '');
				$ip				= request_var('ip', 'ip');

				if ($submit)
				{
					// You can't delete the founder
					if ($delete && $user_row['user_type'] != USER_FOUNDER)
					{
						if (!$auth->acl_get('a_userdel'))
						{
							trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
						}

						// Check if the user wants to remove himself or the guest user account
						if ($user_id == ANONYMOUS)
						{
							trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
						}

						if ($user_id == $user->data['user_id'])
						{
							trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
						}

						if (confirm_box(true))
						{
							user_delete($delete_type, $user_id, $user_row['username']);

							add_log('admin', 'LOG_USER_DELETED', $user_row['username']);
							trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action));
						}
						else
						{
							confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
								'u'				=> $user_id,
								'i'				=> $id,
								'mode'			=> $mode,
								'action'		=> $action,
								'update'		=> true,
								'delete'		=> 1,
								'delete_type'	=> $delete_type))
							);
						}
					}

					// Handle quicktool actions
					switch ($action)
					{
						case 'banuser':
						case 'banemail':
						case 'banip':

							if ($user_id == $user->data['user_id'])
							{
								trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
							}

							if ($user_row['user_type'] == USER_FOUNDER)
							{
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:acp_users.php

示例14: thread_update

                    thread_update($tid, array('fid' => $newfid));
                    $arr = array('uid' => $uid, 'tid' => $thread['tid'], 'pid' => $thread['firstpid'], 'subject' => $thread['subject'], 'comment' => '', 'create_date' => $time, 'action' => 'move');
                    modlog_create($arr);
                }
            }
            message(0, '移动完成');
        }
    }
} elseif ($action == 'deleteuser') {
    $_uid = param(2, 0);
    $method != 'POST' and message(-1, 'Method error');
    empty($group['allowdeleteuser']) and message(-1, '您无权删除用户');
    $u = user_read($_uid);
    empty($u) and message(-1, '用户不存在或者已经被删除。');
    $u['gid'] < 6 and message(-1, '不允许删除管理组,请先调整用户用户组。');
    $r = user_delete($_uid);
    $r === FALSE ? message(-1, '删除失败') : message(0, '删除成功');
} elseif ($action == 'banip') {
    $method != 'POST' and message(-1, 'Method error');
    $_ip = xn_urldecode(param(2));
    empty($_ip) and message(-1, 'IP 为空');
    $_ip = long2ip(ip2long($_ip));
    // 安全过滤
    $day = intval(xn_urldecode(param(3)));
    empty($group['allowbanuser']) and message(-1, '您无权禁止 IP');
    $arr = explode('.', $_ip);
    $arr[0] == '0' and message(-1, 'IP 地址不能以 0 开头。');
    $banip = banip_read_by_ip($_ip);
    if ($day == -1) {
        $r = banip_delete($banip['banid']);
    } else {
开发者ID:xianyuxmu,项目名称:alinkagarden-xiuno,代码行数:31,代码来源:mod.php

示例15: test_delete_user_id_data

    /**
     * @dataProvider delete_user_id_data
     */
    public function test_delete_user_id_data($mode, $cleaned_tables)
    {
        $this->assertFalse(user_delete($mode, 2));
        foreach ($cleaned_tables as $table) {
            $sql = 'SELECT user_id
				FROM ' . $table . '
				WHERE user_id = 2';
            $result = $this->db->sql_query($sql);
            $this->assertFalse($this->db->sql_fetchfield('user_id'), 'Found data for deleted user in table: ' . $table);
            $this->db->sql_freeresult($result);
            $sql = 'SELECT user_id
				FROM ' . $table . '
				WHERE user_id = 3';
            $result = $this->db->sql_query($sql);
            $this->assertEquals(3, $this->db->sql_fetchfield('user_id'), 'Missing data for user in table: ' . $table);
            $this->db->sql_freeresult($result);
        }
    }
开发者ID:hgchen,项目名称:phpbb,代码行数:21,代码来源:delete_user_test.php


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