Delete an electronic address action

@param User $user
@param ElectronicAddress $electronicAddress
@return void
961323
public function deleteElectronicAddressAction(User $user, ElectronicAddress $electronicAddress)
    {
        $user->removeElectronicAddress($electronicAddress);
        $this->userService->updateUser($user);

        $this->addFlashMessage('The electronic address "%s" (%s) has been deleted for "%s".', 'Electronic address removed', Message::SEVERITY_NOTICE, [htmlspecialchars($electronicAddress->getIdentifier()), htmlspecialchars($electronicAddress->getType()), htmlspecialchars($user->getName())], 1412374678);
        $this->redirect('edit', null, null, ['user' => $user]);
    }
1013263
public function delete_from_tenant ( $user_id ) {
		$this->__mustBeTenant ();

		if ( $this->request->is(array('post', 'put') ) ) {
			$alias = MtSites::getSiteName();			
			if ( $this->SiteUser->dismissUserFromSite($alias, $user_id) ) {
				$user['user_id'] = $user_id;
				$this->SiteUser->User->RolUser->deleteAll($user, false);
				$this->Session->setFlash(__d('users','El usuario fue removido del comercio'));
			} else {
				$this->Session->setFlash(__d('users','Error al remover al usuario del comercio.'), 'Risto.flash_error');
			}
		}

		$this->redirect($this->referer() );
	}
691319
protected static function delete_user_data(int $userid, \context $context) {
        global $DB;

        // Delete password history.
        $DB->delete_records('user_password_history', ['userid' => $userid]);
        // Delete last access.
        $DB->delete_records('user_lastaccess', ['userid' => $userid]);
        // Delete password resets.
        $DB->delete_records('user_password_resets', ['userid' => $userid]);
        // Delete user devices.
        $DB->delete_records('user_devices', ['userid' => $userid]);
        // Delete user course requests.
        $DB->delete_records('course_request', ['requester' => $userid]);
        // Delete sessions.
        $DB->delete_records('sessions', ['userid' => $userid]);
        // Do I delete user preferences? Seems like the right place to do it.
        $DB->delete_records('user_preferences', ['userid' => $userid]);

        // Delete all of the files for this user.
        $fs = get_file_storage();
        $fs->delete_area_files($context->id, 'user');

        // For the user record itself we only want to remove unnecessary data. We still need the core data to keep as a record
        // that we actually did follow the request to be forgotten.
        $user = \core_user::get_user($userid);
        // Update fields we wish to change to nothing.
        $user->deleted = 1;
        $user->idnumber = '';
        $user->emailstop = 0;
        $user->icq = '';
        $user->skype = '';
        $user->yahoo = '';
        $user->aim = '';
        $user->msn = '';
        $user->phone1 = '';
        $user->phone2 = '';
        $user->institution = '';
        $user->department = '';
        $user->address = '';
        $user->city = '';
        $user->country = '';
        $user->lang = '';
        $user->calendartype = '';
        $user->theme = '';
        $user->timezone = '';
        $user->firstaccess = 0;
        $user->lastaccess = 0;
        $user->lastlogin = 0;
        $user->currentlogin = 0;
        $user->lastip = 0;
        $user->secret = '';
        $user->picture = '';
        $user->url = '';
        $user->description = '';
        $user->descriptionformat = 0;
        $user->mailformat = 0;
        $user->maildigest = 0;
        $user->maildisplay = 0;
        $user->autosubscribe = 0;
        $user->trackforums = 0;
        $user->timecreated = 0;
        $user->timemodified = 0;
        $user->trustbitmask = 0;
        $user->imagealt = '';
        $user->lastnamephonetic = '';
        $user->firstnamephonetic = '';
        $user->middlename = '';
        $user->alternatename = '';
        $DB->update_record('user', $user);
    }
1348644
public function deleteUser($user) {
    if($this->userExists($user)) {
      $pattern = '/'.$user.'.*/';
      $this->htpwd = array_filter($this->htpwd,function($line) use ($pattern) {
        return (preg_match($pattern,$line) != 1);
      });
      $this->_save();
      return true;
    } else {
      return false;
    }
  }
232735
public function publicDelete($user, Event $event)
    {
        if ($event->creator->id == $user->id) {
            return User::findOrFail($user->id)->hasPermission('laralum::events.delete-public');
        }

        return false;
    }
1102963
public function updateAddress(array $data, $user)
    {
        $this->getEventManager()->trigger('updateInfo.pre', $this, array('user' => $user, 'data' => $data));

        $form  = $this->getServiceManager()->get('playgrounduser_address_form');
        $form->bind($user);
        $form->setData($data);

        $filter = $user->getInputFilter();
        $filter->remove('password');
        $filter->remove('passwordVerify');
        $filter->remove('dob');

        $form->setInputFilter($filter);

        if ($form->isValid()) {
            $user = $this->getUserMapper()->update($user);
            $this->getEventManager()->trigger('updateInfo.post', $this, array('user' => $user, 'data' => $data));

            if ($user) {
                return $user;
            }
        }

        return false;
    }
47363
private function deleteAuthtokens(Entity\Users $user)
    {
        /** @var Repository\AuthtokenRepository $repo */
        $repo = $this->em->getRepository(Entity\Authtoken::class);
        $repo->deleteTokens($user->getId());
    }
166274
public function delete($user)
    {
        if (!is_object($user)) {
            $user = $this->find($user);
        }

        if ($user instanceof User) {
            if ($this->fireEvent('deleting', array($user)) === false) {
                return false;
            }

            $user->delete($this);

            $this->fireEvent('deleted', array($user));
        }
    }
653903
public function deleteAddress( $domain = MShop_Order_Item_Base_Address_Abstract::TYPE_DELIVERY )
	{
		$this->_notifyListeners( 'deleteAddress.before', $domain );

		if( isset( $this->_addresses[$domain] ) ) {
			unset( $this->_addresses[$domain] );
			$this->_modified = true;
		}

		$this->_notifyListeners( 'deleteAddress.after', $domain );
	}
33352
public function delete(User $user, User $entity)
    {
        if ($entity->id === $user->id) {
            return true;
        }
        return $user->hasPermission('user-delete');
    }
728375
public function deleteUser(int $user_id, array $args = [])
    {
        $this->getDriver()->user->delete($user_id, $args);
    }
891108
public function removeUser(\WobbleCode\UserBundle\Document\User $user)
    {
        $this->users->removeElement($user);
    }
993112
function delete_network_account_event( $check_user = true ) {
            $this->_logger->entrance( 'slug = ' . $this->_slug );

            if ( $check_user && ! $this->is_user_admin() ) {
                return;
            }

            $this->do_action( 'before_network_account_delete' );

            // Clear all admin notices.
            $this->_admin_notices->clear_all_sticky();

            $this->_delete_plans( false, false );

            $this->_delete_licenses( false );

            // Delete add-ons related to plugin's account.
            $this->_delete_account_addons( false );

            // @todo Delete plans and licenses of add-ons.

            self::$_accounts->store( true );

            /**
             * IMPORTANT:
             *  Clear crons must be executed before clearing all storage.
             *  Otherwise, the cron will not be cleared.
             */
            $this->clear_sync_cron( true );
            $this->clear_install_sync_cron( true );

            $sites = self::get_sites();

            $install_ids = array();
            foreach ( $sites as $site ) {
                $blog_id = self::get_site_blog_id( $site );

                $install_id = $this->_delete_site( true, $blog_id );

                // Clear all storage data.
                $this->_storage->clear_all( true, array( 'connectivity_test' ), $blog_id );

                if ( FS_Site::is_valid_id( $install_id ) ) {
                    $install_ids[] = $install_id;
                }

                switch_to_blog( $blog_id );

                $this->do_action( 'after_account_delete' );

                restore_current_blog();
            }

            $this->_storage->clear_all( true, array(
                'connectivity_test',
                'is_on',
            ), true );

            // Send delete event.
            if ( ! empty( $install_ids ) ) {
                $result = $this->get_current_or_network_user_api_scope()->call( "/plugins/{$this->_module_id}/installs.json?ids=" . implode( ',', $install_ids ), 'delete' );
            }

            $this->do_action( 'after_network_account_delete' );
        }
1066674
public function deleteServer ( $consumer_key, $user_id, $user_is_admin = false )
	{
		if ($user_is_admin)
		{
			$this->query('
					DELETE FROM oauth_consumer_registry
					WHERE ocr_consumer_key = \'%s\'
					  AND (ocr_usa_id_ref = %d OR ocr_usa_id_ref IS NULL)
					', $consumer_key, $user_id);
		}
		else
		{
			$this->query('
					DELETE FROM oauth_consumer_registry
					WHERE ocr_consumer_key = \'%s\'
					  AND ocr_usa_id_ref   = %d
					', $consumer_key, $user_id);
		}
	}
1227776
protected function deleteExisting(Contracts\RequiresEmailVerification $user)
    {
        return $this->getTable()->where('email', $user->getEmailForVerification())->delete();
    }
119705
public function deleteAddress(Address $address)
    {
        if ($this !== $address->addressable()->first())
            return false;

        return $address->delete();
    }
460664
public function deleteUser(User $user)
    {
        foreach ($user->getAccounts() as $account) {
            $this->securityContext->withoutAuthorizationChecks(function () use ($account) {
                $this->deletePersonalWorkspace($account->getAccountIdentifier());
            });

            $this->accountRepository->remove($account);
        }

        $this->removeOwnerFromUsersWorkspaces($user);

        $this->partyRepository->remove($user);
        $this->emitUserDeleted($user);
    }