InitUserPerms
array CSocNetUserToGroup::InitUserPerms( int userID, array arGroup, bool bCurrentUserIsAdmin );
The method returns array of user permissions for actions within current workgroup. Static method.
Parameters
Parameter | Description | Available from version |
---|---|---|
userID | User ID. | |
arGroup | Array, containing workgroup parameters. This array is returned by the method CSocNetGroup::GetByID or can be received via the method CSocNetGroup::GetList. | |
bCurrentUserIsAdmin | Flag, specifies that user is a social network module or site administrator. |
Returned value
Returns array type:
array
(
[UserRole] => A // user role in workgroup
[UserIsMember] => true // the user is workgroup member
[UserIsOwner] => false // the user is workgroup owner
[UserCanInitiate] => false // user can/cannot accept new members into workgroup
[UserCanViewGroup] => true // user can/cannot see workgroup
[UserCanAutoJoinGroup] => true // user can/cannot join workgroup without approval
[UserCanModifyGroup] => false // user can/cannot modify workgroup parameters
[UserCanModerateGroup] => true // user is/isn't workgroup moderator
[UserCanSpamGroup] => true // user can/cannot send messages in chat to all participants
)
See Also
Examples
<? // Gets array of the current user permissions for the workgroup $ID $arGroup = CSocNetGroup::GetByID($ID); $arCurrentUserPerms = CSocNetUserToGroup::InitUserPerms( $GLOBALS["USER"]->GetID(), $arGroup, CSocNetUser::IsCurrentUserModuleAdmin() ); ?>