Documentation

Update

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

The method modifies parameters for a blog post with ID. Static method.

Method parameters

ParameterDescriptionAvailable from version
ID ID of the modified blog post.
arFields Array of the array("field"=>"value"[, ...]) type, containing values of the blog post fields.
Also, a separate level of access permissions can be specified for the blog post and comments. To do it, the array of the following type must be specified:
array("PERMS_POST" =>    array("userGroupID" => "Permission"[, ...]),
      "PERMS_COMMENT" => array("userGroupID" => "Permission"[, ...]))
where userGroupID - blog user group, Permission - level of access permission.
bSearchIndex Optional parameter. By default value - "true".

Returned value

The method returns the ID of the updated blog post, if the parameters were updated successfully. If an error occurs, method will return false, and exceptions will contain errors.

See Also

Examples of use

<?
$ID = 1;
$arFields = array(
    "TITLE" => 'My first updated blog post',
    "DETAIL_TEXT" => 'Text of my first updated blog post',
    "BLOG_ID" => 1,
    "AUTHOR_ID" => $USER->GetID,
    "DATE_PUBLISH" => '25.08.2007 9:40',
    "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
    "ENABLE_TRACKBACK" => 'N',
    "ENABLE_COMMENTS" => 'Y'
    "PERMS_P" => Array("1" => BLOG_PERMS_DENY, "2" => BLOG_PERMS_DENY),
    "PERMS_C" => Array("1" => BLOG_PERMS_READ, "2" => BLOG_PERMS_WRITE)
);

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


© «Bitrix24», 2001-2024