Airship\Cabin\Bridge\Landing\Author::delete PHP Method

delete() public method

Create a new author profile
public delete ( string $authorId = '' )
$authorId string
    public function delete(string $authorId = '')
    {
        $authorId = (int) $authorId;
        if (!$this->isSuperUser()) {
            $authorsForUser = $this->author->getAuthorIdsForUser($this->getActiveUserId());
            // Check
            if (!\in_array($authorId, $authorsForUser)) {
                \Airship\redirect($this->airship_cabin_prefix . '/author');
            }
        }
        $post = $this->post(new DeleteAuthorFilter());
        if (!empty($post)) {
            if ($this->author->deleteAuthor($authorId, $post['reassign'] ?? 0)) {
                \Airship\redirect($this->airship_cabin_prefix . '/author');
            }
        }
        if ($this->isSuperUser()) {
            $authors = $this->author->getAll();
        } else {
            $authors = $this->author->getForUser($this->getActiveUserId());
        }
        $this->lens('author/delete', ['author' => $this->author->getById($authorId), 'authorsAvailable' => $authors]);
    }