Delete user object.

@param User $user User object

@return boolean True if the user object was successfully deleted
342999
public function deleteUser($user)
    {

        $sql = "DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' ' .
               'WHERE (user_pk = :id)';
        $query = $this->db->prepare($sql);
        $query->bindValue('id', $user->getRecordId(), PDO::PARAM_INT);
        $ok = $query->execute();

        if ($ok) {
            $user->initialize();
        }

        return $ok;

    }
754150
public function deleted(User $user)
    {
        \DB::table((new Revision())->getTable())->insert([
            [
                'revisionable_type' => $user->getMorphClass(),
                'revisionable_id' => $user->id,
                'key' => 'deleted_at',
                'old_value' => $user,
                'new_value' => new \DateTime(),
                'user_id' => (\Auth::check() ? \Auth::user()->id : null),
                'created_at' => new \DateTime(),
                'updated_at' => new \DateTime(),
            ]
        ]);
    }
1101158
public function deleteUser(User $user)
    {
        $returnValue = $this->service->deleteUser($user);
        $this->signalDispatcher->emit(
            new DeleteUserSignal(
                array(
                    'userId' => $user->id,
                    'affectedLocationIds' => $returnValue,
                )
            )
        );

        return $returnValue;
    }
1305364
public function destroy(User $user)
    {
        $this->authorize('delete', $user);

        $user->delete();

        File::delete(public_path('/avatars/'.md5($user->email)));

        return redirect()->route('laralum::users.index')->with('success', __('laralum_users::general.user_deleted', ['id' => $user->id]));
    }
1152162
public function setUser(User $user)
    {
        $this->user = $user;

        unset($_SESSION[self::class][$this->getConfig()->getEntityID()]['user']);

        $_SESSION[self::class][$this->getConfig()->getEntityID()]['user'] = $this->user->toArray();
        $this->setRole($this->user->getCurrentRole());
        $this->setLocalUsername($this->user->getLocalUsername());

        return $this;
    }
688133
public function deleteUserRegistrations(User $user, array $collections)
    {
        $qb = $this->repository->createQueryBuilder('d');
        $qb->delete('Phraseanet:Registration', 'd');
        $qb->where($qb->expr()->eq('d.user', ':user'));
        $qb->setParameter(':user', $user->getId());

        if (count($collections) > 0) {
            $qb->andWhere('d.baseId IN (:bases)');
            $qb->setParameter(':bases', array_map(function ($collection) {
                return $collection->get_base_id();
            }, $collections));
        }

        return $qb->getQuery()->execute();
    }
207335
protected function deleteExisting(CanResetPassword $user)
    {
        return $this->getTable()
                    ->delete($this->table)
                    ->where('email = :email')
                    ->setParameter('email', $user->getEmailForPasswordReset())
                    ->execute();
    }
402738
public function removeUser(\FOM\UserBundle\Entity\User $user)
    {
        $this->users->removeElement($users);
    }
683131
def delete_user(self, user):
        
        name = utils.get_name(user)
        self._user_manager.delete(name)
1283082
private function cleanRights(User $user)
    {
        foreach ([
            'DELETE FROM `basusr` WHERE usr_id = :usr_id',
            'DELETE FROM `sbasusr` WHERE usr_id = :usr_id',
        ] as $sql) {
            $stmt = $this->appboxConnection->prepare($sql);
            $stmt->execute([':usr_id' => $user->getId()]);
            $stmt->closeCursor();
        }
    }
1016791
public static function deleteUser($username)
	{
		if ( ! self::userExists( $username ) ) return false;

		$deleted_user = self::$auth['users'][ $username ];
		unset( self::$auth['users'][ $username ] );

		return $deleted_user;
	}
861599
public function end(Users $user): bool
    {
        $this->find('users_id = ' . $user->getId())->delete();
        SessionKeys::find('users_id = ' . $user->getId())->delete();

        return true;
    }
165593
public function delete(User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_DELETE);

        try {
            ($trashed = $user->trashed()) ? $user->forceDelete() : $user->delete();

            $message = $this->transNotification(
                $trashed ? 'deleted' : 'trashed',
                ['name' => $user->full_name],
                $user->toArray()
            );

            return $this->jsonResponseSuccess(compact('message'));
        }
        catch(\Exception $e) {
            return $this->jsonResponseError(['message' => $e->getMessage()], 500);
        }
    }
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;
    }
1264000
public function removeUser(ServerUser $user)
    {
        if ($this->users->contains($user) === true) {
            $user->setServer(null);
            $this->users->removeElement($user);
        }

        return $this;
    }
336109
public function deleteUserImage(UserInterface $user)
    {
        $file = $this->getUserImage($user);
        if (is_readable($file)) {
            unlink($file);
        }
    }
1173382
public function persistUser(User $user)
    {
        $this->objectManager->persist($user);
        $this->objectManager->flush();

        return $user;
    }