Documentation

Update

int
CBlog::Update(
 int   ID
 array arFields
);

The method modifies parameters of the blog with ID. Non-static method.

Method parameters

ParameterDescription
ID Updated blog ID.
arFields Array of the array("field"=>"value"[, ...]) type, containing the values of [link=90539#blog]blog fields[/link].
Also, access permission level for blog posts and comments can be specified. The array of the array("PERMS_POST" => array("userGroupID" => "Permission"[, ...]), "PERMS_COMMENT" => array("userGroupID" => "Permission"[, ...])) type can be specified, where userGroupID - blog user group, Permission - access permission level.

Returned value

The method returns ID of the updated blog, where the update was successful. For success, minimum one main field shall be modified (for example, DATE_UPDATE). When an error occurs, the method will return false, and exceptions will contain errors.

See Also

  • [link=90539#blog]blog fields[/link]
  • [link=90543]CBlog[/link]::[link=90544]Add[/link]
  • [link=90538]Access permission levels[/link]

Examples of use

<?
$ID = 1;
$arFields = array(
    "NAME" => 'Site administrator blog',
    "DESCRIPTION" => 'Blog describes all modifications, occurring with site',
    "=DATE_UPDATE" => $DB->CurrentTimeFunction(),
    "GROUP_ID" => '1',
    "ENABLE_IMG_VERIF" => 'N',
    "EMAIL_NOTIFY" => 'Y',
    "ENABLE_RSS" => "N",
    "URL" => "admin-blog",
    "ACTIVE" => "Y",
    "OWNER_ID" => $USER->GetID()
);

$updateID = CBlog::Update($ID, $arFields);
if(IntVal($updateID)>0)
{
    echo "Blog [".$updateID."] is updated.";
}
else
{
    if ($ex = $APPLICATION->GetException())
        echo $ex->GetString();
}
?>


© «Bitrix24», 2001-2024