Bitrix Site Manager



The method Update updates the subscription properties. If the e-mail address becomes modified, the method unconfirmes the subscription and fires an event which tells to send a message containing the subscription confirmation code unless this is not explicitly forbidden. If the subscription is not confirmed and the array of fields includes the correct CONFIRM_CODE, the subscription becomes confirmed. 


$ID The subscription ID.
$arFields Associated array containing the keys and values of Subscription object fields. The following fields can also be used:
  • RUB_ID - array containing the ID's of subscriptions to which the e-mail is subscribed;
  • SEND_CONFIRM - specifies to send the message containing the subscription confirmation code to the subscriber when the e-mail address becomes modified (Y/N).
$SITE_ID The ID of the site used to determine the template of the subscription confirmation message. The parameter has the default value of the current site ID. 

Return Values

Returns true on success. In case of an error, it returns false and the class variable LAST_ERROR contains the error description.

On success, the class variable LAST_MESSAGE contains a string with the message code. The following values are possible:


//confirmation code from letter or confirmation form 
if($CONFIRM_CODE <> "" && $ID > 0 && empty($action))
    if($str_CONFIRMED <> "Y")
        //subscribtion confirmation
        if($subscr->Update($ID, array("CONFIRM_CODE"=>$CONFIRM_CODE)))
            $str_CONFIRMED = "Y";
        $strWarning .= $subscr->LAST_ERROR;
        $iMsg = $subscr->LAST_MESSAGE;

//form actions processing
if($ID > 0)
    if($action == "unsubscribe" && CSubscription::IsAuthorized($ID))
        if($subscr->Update($ID, array("ACTIVE"=>"N")))
            $str_ACTIVE = "N";
            $iMsg = "UNSUBSCR";
    if($action == "activate" && CSubscription::IsAuthorized($ID))
        if($subscr->Update($ID, array("ACTIVE"=>"Y")))
            $str_ACTIVE = "Y";
            $iMsg = "ACTIVE";