Documentation

SetBlogPerms

void
CBlog::SetBlogPerms(
 int    ID,
 array  arPerms,
 string permsType = BLOG_PERMS_POST
);

The method sets the level of access permissions to blog posts and comments for the blog ID. Non-static method.

Method parameters

ParameterDescription
ID Blog ID.
arPerms Array of the following type: array("BlogUserGroupID" => "Permissions"[, ...]), where
BlogUserGroupID - user group ID for the current blog,
Permissions - levels of access permissions. Optional parameter.
permsType Type of access permission level, which must be granted. Possible values:
  • BLOG_PERMS_POST - permission for blog posts;
  • BLOG_PERMS_COMMENT - permission for blog comments.
    Optional. By default equals to BLOG_PERMS_POST - the level of blog posts access permissions will be modified.
  • See Also

    Examples of use

    <?
    $ID = 1;
    $arPerms = Array(
            "1" => BLOG_PERMS_READ,
            "2" => BLOG_PERMS_WRITE
        );
    CBlog::SetBlogPerms($ID, $arPerms, BLOG_PERMS_COMMENT);
    ?>

    The following code can be used to permit for the unauthorized and authorized users to post comments with with pre-moderation for this blog:

    CBlog::SetBlogPerms(
             $blogID,
             array(
                "1" => "K",
                "2" => "K"   
             ),
             BLOG_PERMS_COMMENT
          );
    

    Where $blogID — blog ID; 1, 2 — pre-set "all" and "authorized" user groups; K - permission to write with pre-moderation.



    © «Bitrix24», 2001-2024
    Up