Documentation

Add

int
CSocNetUserToGroup::Add(
 array arFields
);

The method adds new binding between user and group. Non-static method.

Parameters

Parameter Description Available from version
arFields Array of binding parameters with parameter names as keys and parameter values as key values. Can contain the following keys:
USER_ID - user ID,
GROUP_ID - group ID,
ROLE - user role in group: SONET_ROLES_MODERATOR - moderator, SONET_ROLES_USER - user, SONET_ROLES_BAN - blacklist, SONET_ROLES_REQUEST - join request,
DATE_CREATE - date when created,
DATE_UPDATE - date when updated,
INITIATED_BY_TYPE - who initialized binding: SONET_INITIATED_BY_USER - user, SONET_INITIATED_BY_GROUP - group,
INITIATED_BY_USER_ID - user ID, who initialized the binding,
MESSAGE - message when requesting to create binding.

Returned value

Returns binding ID on success and false otherwise.

Example

CSocNetUserToGroup::Add(
      array(
      "USER_ID" => $GLOBALS["USER"]->GetID(), 
      "GROUP_ID" => 1,
      "ROLE" => SONET_ROLES_USER,
      "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
      "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
      "INITIATED_BY_TYPE" => SONET_INITIATED_BY_USER,
      "INITIATED_BY_USER_ID" => CUser::GetID(),
      "MESSAGE" => false,
      )
);


© «Bitrix24», 2001-2024
Up