1. Go to this page and download the library: Download instride/opendxp-campaigns library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
class Customer extends Concrete implements NewsletterMemberInterface
{
use NewsletterSubscriptionTrait; // reads and writes the subscription fieldcollection
}
public function __construct(private readonly NewsletterManagerInterface $newsletter) {}
public function signUp(Customer $customer): void
{
$this->newsletter->subscribe($customer, 'newsletter');
}
public function optOut(Customer $customer): void
{
$this->newsletter->unsubscribe($customer, 'newsletter');
}
public function onStatusChanged(MemberSubscriptionStatusChangedEvent $event): void
{
if ($event->getNewStatus() === SubscriptionStatus::UNSUBSCRIBED) {
// …
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.