CSubcription::Update( $ID, $arFields, $SITE_ID=SITE_ID );
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.
Parameter | Description |
---|---|
$ID | The subscription ID. |
$arFields | Associated array containing the keys and values of Subscription
object fields. The following fields can also be used:
|
$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. |
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)) { //unsubscription if($subscr->Update($ID, array("ACTIVE"=>"N"))) { $str_ACTIVE = "N"; $iMsg = "UNSUBSCR"; } } if($action == "activate" && CSubscription::IsAuthorized($ID)) { //activation if($subscr->Update($ID, array("ACTIVE"=>"Y"))) { $str_ACTIVE = "Y"; $iMsg = "ACTIVE"; } } }
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |