PHP code example of markocupic / newsletter-notify-on-subscription-activation-bundle

1. Go to this page and download the library: Download markocupic/newsletter-notify-on-subscription-activation-bundle 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/ */

    

markocupic / newsletter-notify-on-subscription-activation-bundle example snippets


composer 



/**
 * Send notifications on newsletter subscription activation
 * extension for Contao Open Source CMS
 *
 * @copyright  Copyright (c) 2019, markocupic
 * @author     markocupic <m.cupic@gmx.ch>
 * @link https://github.com/markocupic/newsletter-notify-on-subscription-activation-bundle
 * @license    MIT
 */

namespace Markocupic;

/**
 * Class BeforeNotifyOnSubscriptionActivation
 * @package Markocupic
 */
class BeforeNotifyOnSubscriptionActivation
{

    /**
     * Pass $arrTokens by reference!!!
     * @param $arrTokens
     * @param $objSubscriber
     * @param $objChannel
     * @param $objNotification
     * @return bool
     */
    public function beforeNotifyOnSubscriptionActivation(&$arrTokens, $objSubscriber, $objChannel, $objNotification)
    {
        $arrTokens['recipient_email'] = 'hans_muster@foofoo.bar';
        $arrTokens['newsletter_title'] = 'My incredible newsletter';

        // Return true, if notification should be sent
        return true;
    }

}



// config.php
$GLOBALS['TL_HOOKS']['beforeNotifyOnSubscriptionActivation'][] = array('Markocupic\BeforeNotifyOnSubscriptionActivation','beforeNotifyOnSubscriptionActivation');