UserModel::deleteContent PHP Méthode

deleteContent() public méthode

Delete a user's content across many contexts.
public deleteContent ( integer $UserID, array $Options = [], array $Content = [] ) : boolean | integer
$UserID integer
$Options array
$Content array
Résultat boolean | integer
    public function deleteContent($UserID, $Options = [], $Content = [])
    {
        $Log = val('Log', $Options);
        if ($Log === true) {
            $Log = 'Delete';
        }
        $Result = false;
        // Fire an event so applications can remove their associated user data.
        $this->EventArguments['UserID'] = $UserID;
        $this->EventArguments['Options'] = $Options;
        $this->EventArguments['Content'] =& $Content;
        $this->fireEvent('BeforeDeleteUser');
        $User = $this->getID($UserID, DATASET_TYPE_ARRAY);
        if (!$Log) {
            $Content = null;
        }
        // Remove invitations
        $this->getDelete('Invitation', ['InsertUserID' => $UserID], $Content);
        $this->getDelete('Invitation', ['AcceptedUserID' => $UserID], $Content);
        // Remove activities
        $this->getDelete('Activity', ['InsertUserID' => $UserID], $Content);
        // Remove activity comments.
        $this->getDelete('ActivityComment', ['InsertUserID' => $UserID], $Content);
        // Remove comments in moderation queue
        $this->getDelete('Log', ['RecordUserID' => $UserID, 'Operation' => 'Pending'], $Content);
        // Clear out information on the user.
        $this->setField($UserID, ['About' => null, 'Title' => null, 'Location' => null]);
        if ($Log) {
            $User['_Data'] = $Content;
            unset($Content);
            // in case data gets copied
            $Result = LogModel::insert($Log, 'User', $User, val('LogOptions', $Options, []));
        }
        return $Result;
    }
UserModel