Deletes a user_meta_* row

@param  string  $sTable  The table to delete from
@param  integer $iUserId The ID of the user the record belongs to

@return boolean
14188
public function delete($sTable, $iUserId)
    {
        $oDb = Factory::service('Database');
        $oDb->where('user_id', $iUserId);
        if (!$oDb->delete($sTable)) {
            return false;
        }

        $this->unsetCache('user-meta-' . $sTable . '-' . $iUserId);
        return true;
    }
1119080
public function authz_delete_user($uid) {
		$udata = $this->user_data;
		if ($udata['uid'] == 1 && $uid != 1)
			return true;
		if ($udata['uid'] == $uid)
			return true;
		return false;
	}
267862
public function removeMember($id, $userId)
    {
        try {
            $result = $this->service->remove(Auth::user(), $id, $userId);

            if ($result) {
                return back()->with('message', 'Successfully removed member');
            }

            return back()->with('message', 'Failed to remove member');
        } catch (Exception $e) {
            return back()->withErrors($e->getMessage());
        }
    }
1276842
protected function getUserId($iUserId = null)
    {
        if (!empty($iUserId)) {
            $iUid = (int) $iUserId;
        } elseif ($this->activeUser('id')) {
            $iUid = $this->activeUser('id');
        } else {
            $this->setError('No user ID set');
            return false;
        }

        return $iUid;
    }
214453
public function delete()
    {
        // we will NOT let you delete the admin user
        if ($this->getUserID() == USER_SUPER_ID) {
            return false;
        }

        // Dispatch an on_user_delete event, that every subscriber can cancel.
        $ue = new DeleteUserEvent($this);
        $ue = $this->getDirector()->dispatch('on_user_delete', $ue);
        if (!$ue->proceed()) {
            return false;
        }

        // Dispatch an on_user_deleted event: subscribers can't cancel this event.
        // This event could be at the end of this method, but let's keep it here so that subscribers
        // can get all the details of the user being deleted.
        $this->getDirector()->dispatch('on_user_deleted', new UserInfoEvent($this));

        $attributes = $this->attributeCategory->getAttributeValues($this->getEntityObject());
        foreach ($attributes as $attribute) {
            $this->attributeCategory->deleteValue($attribute);
        }

        $this->connection->executeQuery('DELETE FROM OauthUserMap WHERE user_id = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM Logs WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM UserSearchIndexAttributes WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM UserGroups WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM UserValidationHashes WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM Piles WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM ConfigStore WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM ConversationSubscriptions WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM PermissionAccessEntityUsers WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM authTypeConcreteCookieMap WHERE uID = ?', [(int) $this->getUserID()]);

        // Conversation messages and ratings should be detached from the user
        $this->connection->executeQuery('UPDATE ConversationMessages SET uID = 0, cnvMessageAuthorName = NULL, cnvMessageAuthorEmail = NULL, cnvMessageAuthorWebsite = NULL, cnvMessageSubmitIP = NULL, cnvMessageSubmitUserAgent = NULL WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('UPDATE ConversationMessageRatings SET cnvMessageRatingIP = NULL, uID = 0 WHERE uID = ?', [(int) $this->getUserID()]);

        // Public file sets should be detached from the user
        $this->connection->executeQuery('UPDATE FileSets SET uID = 0 WHERE uID = ? AND fsType = ?', [
            (int) $this->getUserID(),
            \Concrete\Core\File\Set\Set::TYPE_PUBLIC,
        ]);

        // Delete private file sets from this user
        foreach (\Concrete\Core\File\Set\Set::getOwnedSets($this) as $set) {
            $set->delete();
        }



        $this->connection->executeQuery('UPDATE Blocks set uID = ? WHERE uID = ?', [(int) USER_SUPER_ID, (int) $this->getUserID()]);
        $this->connection->executeQuery('UPDATE Pages set uID = ? WHERE uID = ?', [(int) USER_SUPER_ID, (int) $this->getUserID()]);
        $this->connection->executeQuery('UPDATE DownloadStatistics set uID = 0 WHERE uID = ?', [(int) $this->getUserID()]);

        // We need to clear out the doctrine proxies for userSignups or we will get a Doctrine Error
        /** @var \Concrete\Core\Entity\User\UserSignup[] $userSignups */
        $userSignups = $this->entityManager->getRepository(\Concrete\Core\Entity\User\UserSignup::class)->findBy(['createdBy'=>(int) $this->getUserID()]);
        $superAdminEntity = $this->entityManager->getRepository(UserEntity::class)->find((int) USER_SUPER_ID);

        foreach ($userSignups as $userSignup) {
            // If there is no SuperAdmin Just remove the relatedUserSignups
            if (is_object($superAdminEntity)) {
                $userSignup->setCreatedBy($superAdminEntity);
                $this->entityManager->persist($userSignup);
            } else {
                $this->entityManager->remove($userSignup);
            }

        }

        $this->entityManager->remove($this->entity);
        $this->entityManager->flush();

        return true;
    }
139512
public function get($sTable, $iUserId, $aColumns = [])
    {
        //  Check cache
        $oDb       = Factory::service('Database');
        $sCacheKey = 'user-meta-' . $sTable . '-' . $iUserId;
        $oCache    = $this->getCache($sCacheKey);

        if (!empty($oCache)) {
            return $oCache;
        }

        if (!empty($aColumns)) {
            $oDb->select($aColumns);
        }

        $oDb->where('user_id', $iUserId);
        $aResult = $oDb->get($sTable)->result();

        if (empty($aResult)) {
            $mOut = null;
        } else {
            $mOut = reset($aResult);
        }

        $this->setCache($sCacheKey, $mOut);

        return $mOut;
    }
539567
protected function process_remove_submission($userid = 0) {
        require_sesskey();

        if (!$userid) {
            $userid = required_param('userid', PARAM_INT);
        }

        return $this->remove_submission($userid);
    }
988867
public function genAI($sTable) {
		$sTable = '`' . addslashes($sTable) . '`';
		$sQuery = 'INSERT INTO ' . $sTable . ' () VALUES ()';
		$iID = $this->getInsertID($sQuery);
		if ($iID && ($iID % 1000 == 0)) {
			$sQuery = 'DELETE FROM ' . $sTable;
			$this->exec($sQuery);
		}
		return $iID;
	}
1108089
public function revoke($iUserId, $mToken)
    {
        if (is_string($mToken)) {
            $oToken = $this->getByToken($mToken);
        } else {
            $oToken = $mToken;
        }

        if ($oToken) {

            if ($oToken->user_id === $iUserId) {
                return $this->delete($oToken->id);
            } else {
                $this->setError('Not authorised to revoke that token.');
                return false;
            }

        } else {
            return false;
        }
    }
806791
public function deleteByUserIDs( array $userIDArray )
    {
        // re use destroy to make sure it works with callbacks
        $db = eZDB::instance();
        $userINString = $db->generateSQLINStatement( $userIDArray, 'user_id', false, false, 'int' );
        $rows = $db->arrayQuery( "SELECT session_key FROM ezsession WHERE $userINString" );
        foreach ( $rows as $row )
        {
            $this->destroy( $row['session_key'] );
        }
    }
467141
public static function removeUserFromGroups($uid)
	{
		$db = \App::get('db');
		$tables = array('#__xgroups_members', '#__xgroups_managers', '#__xgroups_invitees', '#__xgroups_applicants');

		foreach ($tables as $table)
		{
			$sql = "DELETE FROM `".$table."` WHERE uidNumber=" . $db->quote($uid);
			$db->setQuery($sql);
			$db->query();
		}

		return true;
	}
137929
public function deleteById($id)
	{
		$sql = "DELETE FROM `$this->tableName` WHERE `$this->pkColName` = :entityId ";

		$stmt = $this->pdo->prepare($sql);
		$stmt->bindParam(':entityId', intval($id), \PDO::PARAM_INT);
		$res = $stmt->execute();

		return ($res !== false && $stmt->rowCount() === 1);
	}
686535
public function setCacheUser($iUserId, $aData = [])
    {
        $this->unsetCacheUser($iUserId);
        $oUser = $this->getById($iUserId);

        if (empty($oUser)) {
            return false;
        }

        $this->setCache(
            $this->prepareCacheKey($this->tableIdColumn, $oUser->id, $aData),
            $oUser
        );

        return true;
    }
1329219
public function resetFailedLogin($iUserId)
    {
        $oDb = Factory::service('Database');
        $oDb->set('failed_login_count', 0);
        $oDb->set('failed_login_expires', 'null', false);
        return $this->update($iUserId);
    }
1343281
public static function can_create_data_deletion_request_for_other(int $userid = null): bool {
        global $USER;
        $userid = $userid ?: $USER->id;
        return has_capability('tool/dataprivacy:requestdeleteforotheruser', context_system::instance(), $userid);
    }
643364
public function update($sTable, $iUserId, $aData)
    {
        //  Safety: Ensure that the user_id is not overridden
        $aData['user_id'] = $iUserId;

        $oDb = Factory::service('Database');
        $oDb->where('user_id', $iUserId);
        if ($oDb->count_all_results($sTable)) {

            $oDb->set($aData);
            $oDb->where('user_id', $iUserId);
            $bResult = $oDb->update($sTable);

        } else {

            $oDb->set($aData);
            $bResult = $oDb->insert($sTable);
        }

        if ($bResult) {
            $this->unsetCache('user-meta-' . $sTable . '-' . $iUserId);
        }

        return $bResult;
    }
490660
public function removeMember($groupId, $userId)
    {
        $this
            ->database
            ->delete('ucms_group_access')
            ->condition('group_id', $groupId)
            ->condition('user_id', $userId)
            ->execute()
        ;

        // @todo dispatch event

        $this->touch($groupId);

        $this->resetCache();
    }