ArticleAuthor::OnAuthorDelete PHP Method

OnAuthorDelete() public static method

Remove article pointers for the given author.
public static OnAuthorDelete ( $p_authorId ) : void
return void
    public static function OnAuthorDelete($p_authorId)
    {
        global $g_ado_db;
        $queryStr = 'DELETE FROM ' . self::TABLE . '
            WHERE fk_author_id = ' . (int) $p_authorId;
        $g_ado_db->Execute($queryStr);
    }

Usage Example

Ejemplo n.º 1
0
    /**
     * @return boolean
     */
    public function delete()
    {
        if (!$this->exists()) {
            return false;
        }

        // Unlink articles
        ArticleAuthor::OnAuthorDelete($this->getId());
        // Unlink aliases
        AuthorAlias::OnAuthorDelete($this->getId());
        // Unlink authors
        AuthorAssignedType::OnAuthorDelete($this->getId());
        // Unlink biographies
        AuthorBiography::OnAuthorDelete($this->getId());

        // Save author data for logging purposes
        $tmpData = $this->m_data;
        // Delete row from Authors table.
        $result = parent::delete();
        if ($result) {
            if (function_exists("camp_load_translation_strings")) {
                camp_load_translation_strings("api");
            }
            $logText = getGS('Author #$1 "$2" deleted.',
                $tmpData['id'], $tmpData['first_name'] . ' ' . $tmpData['last_name']);
            Log::Message($logText, null, 174);
        }

        return $result;
    }
All Usage Examples Of ArticleAuthor::OnAuthorDelete