If the subscription feature is enabled for a standard list, the Inx_Api_Subscription_SubscriptionManager can be used to subscribe and unsubscribe recipients and to retrieve log entries concerning subscription.
If the subscription feature is enabled for a standard list, the Inx_Api_Subscription_SubscriptionManager can be used to subscribe and unsubscribe recipients and to retrieve log entries concerning subscription. The behaviour is the same as if a recipient subscribes to a list via a web frontend. For example, if double opt in is configured, calling processSubscription() will start the normal double opt in subscription process.
The subscription process requires some information:
The following snippet shows how to subscribe the recipient with the email address name@company.com, the last name Smith, the birthday 1994-10-25 and two children to the specified list, using the specified remote address and Hompage(german) as source:
$aAttributes = array( "Lastname" => "Smith", "Birthday" => "2004-05-06", "Children" => 2 ); $oSubscriptionManager = $oSession->getSubscriptionManager(); $iResult = $oSubscriptionManager->processSubscription( "Homepage(german)", $sRemoteAddr, $oListContext, "name@company.com", $aAttributes );
The unsubscription of recipients works pretty much the same. There is only one additional parameter: the mailing reference. This string identifies the mailing which contains the link used to unsubscribe the recipient. However, the mailing reference is only known if the link used for the unsubscription is known. This is the case for unsubscription JSPs but not for common API usage. In most cases the unsubscription of a recipient is accomplished using the Inx_Api_Recipient_RecipientRowSet or the Inx_Api_Recipient_BatchChannel.
The following snippet shows how to unsubscribe the recipient with the email address name@company.com from the specified list, using the specified remote address and mailing reference and Homepage(german) as source:
$oSubscriptionManager = $oSession->getSubscriptionManager(); $iResult = $oSubscriptionManager->processUnsubscription( "Homepage(german)", $sRemoteAddr, $oListContext, "name@company.com", $sMailingRef, null );
The result is either PROCESS_ACTIVATION_SUCCESSFULLY if the subscription or unsubscription succeeded, or PROCESS_ACTIVATION_FAILED_ADDRESS_ILLEGAL if the address is not conform to the RFC standard.
In most circumstances, you would add the recipient to the system list with all his profile data prior to calling the SubscriptionManager. For an example on how to add recipients to the system list, see the Inx_Api_Recipient_RecipientContext documentation.
The Inx_Api_Subscription_SubscriptionManager may also be used to retrieve log entries concerning subscription. For example you can retrieve all log entries associated with the subscription and unsubscription of a specific list in the last month. The following snippet shows how to do this and prints out some of the information:
// create start date $sOneMonthAgo = date('c', strtotime("-1 month")); // create recipient context and attributes to query $oRecipientContext = $oSession->createRecipientContext(); $oRecipientMetaData = $oRecipientContext->getMetaData(); $oAttribute_email = $oRecipientMetaData->getEmailAttribute(); $oAttribute_lastname = $oRecipientMetaData->getUserAttribute( "Lastname" ); $aAttributes = array( $oAttribute_email, $oAttribute_lastname ); $oSubscriptionManager = $oSession->getSubscriptionManager(); $oSubscriptionLogEntryRowSet = $oSubscriptionManager->getLogEntriesAfterAndList( $oListContext, $sOneMonthAgo, $oRecipientContext, $aAttributes ); while( $oSubscriptionLogEntryRowSet->next() ) { echo "Log message: ".$oSubscriptionLogEntryRowSet->getLogMessage()."<br>"; echo "Log date: ".$oSubscriptionLogEntryRowSet->getEntryDatetime()."<br>"; echo "Email address: ".$oSubscriptionLogEntryRowSet->getString( $oAttribute_email )."<br>"; echo "Lastname: ".$oSubscriptionLogEntryRowSet->getString( $oAttribute_lastname )."<br><br>"; }For more information on this topic, see the Inx_Api_Subscruption_SubscriptionLogEntryRowSet documentation.
Located in /Api/Subscription/SubscriptionManager.php (line 103)
Returns an Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries.
Returns an Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries after a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries after a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list and after a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list and after a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries before a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries before a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list and before a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list and before a given date.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries between given dates.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries between given dates.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list and between the given dates.
Returns a Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list and between the given dates.
Returns an Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list.
Returns an Inx_Api_Subsciption_SubscriptionLogEntryRowSet containing all existing (un)subscription log entries for a given list.
Activates the subscription process for the specified email address and sets the attribute values specified in the given associative array.
Activates the subscription process for the specified email address and sets the attribute values specified in the given associative array.
Activates the unsubscription process for the specified email address and mailing id.
Activates the unsubscription process for the specified email address and mailing id. The mailing id specifies the mailing, which contains the unsubscription link used to unsubscribe the recipient.
Activates the unsubscription process for the specified email address and mailing id and sets the attribute values specified in the given associative array.
Activates the unsubscription process for the specified email address and mailing id and sets the attribute values specified in the given associative array. The mailing id specifies the mailing, which contains the unsubscription link used to unsubscribe the recipient.
Activates the unsubscription process for the specified email address and mailing reference and sets the attribute values specified in the given associative array.
Activates the unsubscription process for the specified email address and mailing reference and sets the attribute values specified in the given associative array. The mailing reference specifies the mailing, which contains the unsubscription link used to unsubscribe the recipient.
Subscription or Unsubscription process activation has failed, the address is not conform to the RFC standard.
Subscription or Unsubscription process activation has failed, the address is not conform to the RFC standard.
Subscription or Unsubscription process has been successfully activated.
Subscription or Unsubscription process has been successfully activated.
Documentation generated on Thu, 17 Sep 2015 14:27:31 +0200 by phpDocumentor 1.3.2