Delete a Rating.

@param string $userId
@param string $ratingId

@throws RatingPermissionException
175820
public function deleteRating($userId, $ratingId)
    {
        $rating = $this->getRatingById($ratingId);

        $this->validateUserPermissionsToManageRating($rating, $userId);

        $rating = $this->disableSubShopDeleteProtectionForRating($rating);
        $rating->delete();
    }
339265
protected static function delete_user_data($userid) {
        global $DB;

        // Delete the stuff.
        $DB->delete_records('badge_manual_award', ['recipientid' => $userid]);
        $DB->delete_records('badge_criteria_met', ['userid' => $userid]);
        $DB->delete_records('badge_issued', ['userid' => $userid]);

        // Delete the backpacks and related stuff.
        $backpackids = $DB->get_fieldset_select('badge_backpack', 'id', 'userid = :userid', ['userid' => $userid]);
        if (!empty($backpackids)) {
            list($insql, $inparams) = $DB->get_in_or_equal($backpackids, SQL_PARAMS_NAMED);
            $DB->delete_records_select('badge_external', "backpackid $insql", $inparams);
            $DB->delete_records_select('badge_backpack', "id $insql", $inparams);
        }
    }
432774
protected static function delete_user_competencies_in_course($courseid, $userids = []) {
        global $DB;

        $params = ['courseid' => $courseid];
        $where = "courseid = :courseid";

        if (!empty($userids)) {
            list($insql, $inparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
            $params = $params + $inparams;

            $where .= " AND userid {$insql}";
        }

        $DB->delete_records_select(user_competency_course::TABLE, $where, $params);
    }
677197
protected static function delete_user_data(int $userid) {
        global $DB;

        // Delete individual conversations information for this user.
        self::delete_user_data_conversations($userid, [], '', '');

        // Delete contacts, requests, users blocked and notifications.
        $DB->delete_records_select('message_contacts', 'userid = ? OR contactid = ?', [$userid, $userid]);
        $DB->delete_records_select('message_contact_requests', 'userid = ? OR requesteduserid = ?', [$userid, $userid]);
        $DB->delete_records_select('message_users_blocked', 'userid = ? OR blockeduserid = ?', [$userid, $userid]);
        $DB->delete_records_select('notifications', 'useridfrom = ? OR useridto = ?', [$userid, $userid]);
    }
539567
protected function process_remove_submission($userid = 0) {
        require_sesskey();

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

        return $this->remove_submission($userid);
    }
491111
protected function is_graded($userid) {
        $grade = $this->get_user_grade($userid, false);
        if ($grade) {
            return ($grade->grade !== null && $grade->grade >= 0);
        }
        return false;
    }
746078
public function authRoleUserDelete($user_id){
        self::where(['user_id'=>$user_id])->delete();
        AuthAccess::where(['role_id'=>$user_id,'type'=>'admin'])->delete();
    }
339624
public function delete(Resource\ResourceId $resourceId)
    {
        $this->crudRepositoryAdapter->deleteResource($this->resourceType, $resourceId);
    }
321718
public function getRatingsByUserId($userId)
    {
        $queryBuilder = $this->queryBuilderFactory->create();
        $queryBuilder
            ->select('r.*')
            ->from('oxratings', 'r')
            ->where('r.oxuserid = :userId')
            ->orderBy('r.oxtimestamp', 'DESC')
            ->setParameter('userId', $userId);

        return $this->mapRatings($queryBuilder->execute()->fetchAll());
    }
969872
public function deleteRevision($contentId, $revisionId)
    {
        $this->loadModel('Content.ContentRevisions');
        $revision = $this->ContentRevisions->find()
            ->where(['id' => $revisionId, 'content_id' => $contentId])
            ->first();

        if ($this->ContentRevisions->delete($revision, ['atomic' => true])) {
            $this->Flash->success(__d('content', 'Revision was successfully removed!'));
        } else {
            $this->Flash->danger(__d('content', 'Unable to remove this revision, please try again.'));
        }

        $this->title(__d('content', 'Editing Content Revision'));
        $this->redirect($this->referer());
    }
47695
public function delete($userId)
    {
        if (is_array($userId)) {
            return $this->batchDelete($userId);
        }

        return $this->httpGet('cgi-bin/user/delete', ['userid' => $userId]);
    }
98295
public function deletePermissions($resourceId)
    {
        $rules = $this->aclDataService->getRulesByResource($resourceId)
            ->getData();
        /** @var \RcmUser\Acl\Entity\AclRole $role */
        foreach ($rules as $rule) {
            $result = $this->aclDataService->deleteRule($rule);

            if (!$result->isSuccess()) {
                return false;
            }
        }

        return true;
    }
106662
public function addRating($videoId, $rating)
    {
        $this->validateRating($rating);
        $customMetaData = $this->getVideo($videoId)->getCustomMetadata();

        $average = $this->getRatingAverage($videoId);
        $count = $this->getRatingCount($videoId);
        $newCount = $count + 1;

        $customMetaData[$this->metadataFieldCount] = $newCount;
        $customMetaData[$this->metadataFieldAverage] = (($average * $count) + $rating) / $newCount;

        $this->storeCustomMetaData($customMetaData, $videoId);
    }
279514
public function revoke($role, $userId) {
		$userId = $this->getId($userId);
		$entity = \App::$domain->account->login->oneById($userId);
		$this->model->deleteAll(['user_id' => $userId, 'item_name' => $role]);
	}
318115
public static function delete_user_evidence_competency($userevidenceorid, $competencyid) {
        global $USER;
        static::require_enabled();

        $userevidence = $userevidenceorid;
        if (!is_object($userevidence)) {
            $userevidence = self::read_user_evidence($userevidence);
        }

        // Perform user evidence capability checks.
        if (!$userevidence->can_manage()) {
            $context = $userevidence->get_context();
            throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
        }

        // Get (and delete) the relation.
        $relation = user_evidence_competency::get_relation($userevidence->get('id'), $competencyid);
        if (!$relation->get('id')) {
            return true;
        }

        $success = $relation->delete();
        if ($success) {
            self::add_evidence(
                $userevidence->get('userid'),
                $competencyid,
                $userevidence->get_context(),
                evidence::ACTION_LOG,
                'evidence_evidenceofpriorlearningunlinked',
                'core_competency',
                $userevidence->get('name'),
                false,
                null,
                null,
                $USER->id
            );
        }

        return $success;
    }
212113
public function delete($userid)
	{
		$event = new Event('onPlatformUserDelete');
		$event->addArgument('userid', $userid);
		$event->addArgument('activePlugin', $this->activePlugin);

		Factory::getDispatcher()->triggerEvent($event);

		$debug = $event->getArgument('debug', null);
		if ($debug) {
			$this->debug[] = $debug;
		}

		$error = $event->getArgument('error', null);
		if ($error) {
			$this->error[] = $error;
		}
	}
1009844
public function deleteUser($userId)
    {
        try {
            return $this->innerGateway->deleteUser($userId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }