Documentation

GetUserPerms

string
CBlogUser::GetUserPerms(
 array arGroups,
 int   blogID,
 int   postID = 0,
 int   permsType = BLOG_PERMS_POST,
 int   selectType = BLOG_BY_BLOG_USER_ID,
);

The method returns access permission level of a blog user for permsType, associated with the arGroups groups, for the postID message of the blog with ID. Static method.

Method parameters

ParameterDescription
arGroups Array of the blog user groups or a user ID. If the user ID is specified, the method autonomously will get blog user groups.
blogID Blog ID.
postID Blog post ID.
Optional. By default 0 - returns access permission level by default.
permsType Type of access permission. Possible values:
  • BLOG_PERMS_POST - access permission for blog posts;
  • BLOG_PERMS_COMMENT - access permission for comments.
Optional. By default, BLOG_PERMS_POST - access permission level for blog posts.
selectType Contains the ID of the user to be searched. Only used when user ID is passed as the first parameter. Possible values:
  • BLOG_BY_USER_ID - by the site user ID;
  • BLOG_BY_BLOG_USER_ID - by the blog user ID.
    Optional. By default BLOG_BY_BLOG_USER_ID - by the blog user ID.
  • Returned value

    The method returns access permission level for the user.

    See Also

    Examples of use

    <?
    // retrieve access permission level to posts of the blog with the ID 2
    $blogID = 2;
    $arUserGroups = CBlogUser::GetUserGroups($userID, $blogID, "Y", BLOG_BY_USER_ID);
    $perms = CBlogUser::GetUserPerms(arUserGroups, $blogID, 0, BLOG_PERMS_POST);
    echo "You have the following access permission for the blog posts: ".$perms;
    ?>


    © «Bitrix24», 2001-2023
    Up