Add
int CBlog::Add( array arFields );
This method adds a new blog. Non-static method.
Method parameters
Parameter | Description |
---|---|
arFields |
Array of the array("field"=>"value"[, ...]) type, containing values of blog fields. Also, access permission level can be specified for blog posts and comments. To do this, array of the array("PERMS_POST" => array("userGroupID" => "Permission"[, ...]), "PERMS_COMMENT" => array("userGroupID" => "Permission"[, ...])) type must be created, where userGroupID - blog users group Permission - level of access permissions. |
Returned value
The method returns the ID of added blog, if the adding was successful. When an error occurs, the method will return false, and exceptions will contain errors.See Also
Examples of use
<? $arFields = array( "NAME" => 'Site administrator blog', "DESCRIPTION" => 'Blog describes all changes, occurring on site', "GROUP_ID" => '1', "ENABLE_IMG_VERIF" => 'Y', "EMAIL_NOTIFY" => 'Y', "ENABLE_RSS" => "Y", "URL" => "admin-blog", "ACTIVE" => "Y", "OWNER_ID" => $USER->GetID() ); $newID = CBlog::Add($arFields); if(IntVal($newID)>0) { echo "New blog [".$newID."] is created."; } else { if ($ex = $APPLICATION->GetException()) echo $ex->GetString(); } ?>
© «Bitrix24», 2001-2024