Documentation

CForumGroup::Add

int
Add(
 array arFields
);

The method Add creates a new group with parameters specified in the array arFields. Returns the ID of the created group. Parameters of the forum visitors are not changed at once when a new rank is added, but gradually, as the visitors post new messages in the forum.

Parameters

ParameterDescription
arFields An array of the format Array(field1=>value1[, field2=>value2 [, ..]]), where

field - field name;
value - field value.

The fields are listed in the List of group fields. The "LANG" special field may be set to an array of arrays containing the fields with language parameters of a group. These arrays have the similar structure.

Return Values

Returns the ID of the created group on success, or false otherwise.

See Also

  • Fields of a group

    Example


    
    <?
    $arFields = array("SORT" => $SORT);
    $arSysLangs = array("fr", "en");
    for ($i = 0; $i<count($arSysLangs); $i++)
    {
      $arFields["LANG"][] = array(
        "LID" => $arSysLangs[$i],
        "NAME" => ${"NAME_".$arSysLangs[$i]},
        "DESCRIPTION" => ${"DESCRIPTION_".$arSysLangs[$i]}
        );
    }
    $ID = CForumGroup::Add($arFields);
    if (IntVal($ID)<=0)
      echo "Error!";
    ?>
    
  • © «Bitrix24», 2001-2024