PHP code example of markocupic / contao-frontend-user-notification

1. Go to this page and download the library: Download markocupic/contao-frontend-user-notification 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 / contao-frontend-user-notification example snippets


// Add the notification programmatically
$type = 'happy-birthday-msg';

/** @var \Contao\FrontendUser $user */
$user = $this->getUser();  // Select a user who should have a notification displayed in the frontend.

$messageTitle = 'Happy  Birthday'
$messageText = 'bla, bla, bla';
$endOfLifeTimeStamp = time() + 7*24*3600; // 1 week

new Markocupic\ContaoFrontendUserNotification\Notification\DefaultFrontendUserNotification($user, $type, $messageTitle, $messageText, $endOfLifeTimeStamp)