Documentation

Add

int
CBlogUser::Add(
 array arFields
);

The methid adds a new blog user. Static method.

Method parameters

ParameterDescription
arFields Array of the array("field"=>"value"[, ...]) type, containing values of the user fields.

Returned value

The method returns the ID of added user on success. If an error occurs, the method returns false, and exceptions will contain errors.

See Also

Examples of use

<?
//create profile of the blog user for the current user
$arFields = array(
    "USER_ID" => $USER->GetID(),
    "=LAST_VISIT" => $DB->GetNowFunction(),
    "=DATE_REG" => $DB->GetNowFunction(),
    "ALLOW_POST" => "Y",
    "ALIAS" => "User alias",
    "DESCRIPTION" => "Regular user of the site with blog",
    "INTERESTS" => "programming, PHP, MySQL, Bitrix24"
);

$newID = CBlogUser::Add($arFields);
if(IntVal($newID)>0)
{
    echo "New user of the blog [".$newID."] added.";
}
else
{
    if ($ex = $APPLICATION->GetException())
        echo $ex->GetString();
}
?>


© «Bitrix24», 2001-2024
Up