mediadreams / md-notifications
Notify frontend users about new data records.
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
Type:typo3-cms-extension
Requires
- typo3/cms-core: ^12.4
This package is auto-updated.
Last update: 2025-03-26 13:22:02 UTC
README
Requirements
- TYPO3 >= 12.4
Screenshots
Installation
- Install the extension by using composer (
composer req mediadreams/md-notifications
) or using the extension manager - Include the static TypoScript of the extension
- Configure the extension (see chapter Configuration)
Configuration
Configuration is done in the sites configuration file. Either add the configuration
directly in config/sites/site-itentifier/config.yaml
, or import a YAML file
by using this command:
imports:
- { resource: "EXT:my_extension/Configuration/Yaml/MdNotifications.yaml" }
Following configuration can be added:
md_notifications:
# The page Id, where the notification records get stored
# If no `storagePid` is provided, the records will be saved on page Id = 0
storagePid: 123
# If this is set, notifications will be saved for users who belong to groupId only.
feGroup: 3
# Configure recod types for notifications
# All record types can be configured. Just add a section for the table name of the record.
# All pages which have page Id 6 in it's rootline, will get notifications.
pages:
- 6
# All news records which will be saved on a pages within the rootline of page 2 or 16 will receive notofications.
tx_news_domain_model_news:
- 2
- 16
Hint:
You can use environment variables in the site configuration like this:
storagePid: "%env(md_notifications_storagePid)%"
Usage
As soon as you have installed and activated the extension, it will hook into the saving process of records. Everytime a backend user adds a configured record, the unread info for this record and the configured feUsers will be added.
List plugin
The extension ships a content element Notifications
, which shows a list of all
notifications for the logged in user. In the Plugin
-tab you have the following
configuration options:
Record keys
Comma separated list of record keys (table names). Leave empty, if all records shall be shown.Startingpoint
The page on which the notification records are stored.
Notification counter
This counter will show the number of notifications for a user.
Use following code in your fluid template in order to get number of all notifications:
<f:cObject typoscriptObjectPath="lib.mdNotificationsCount" />
Use this to get number of notifications for example for pages
and tx_news_domain_model_news
records:
<f:cObject typoscriptObjectPath="lib.mdNotificationsCount" data="{recordKeys:'pages,tx_news_domain_model_news'}" />
Show notification info of record
Use the following code in the fluid template to show, whether the current logged in feUser has read the item.
Example for a page record:
<f:cObject typoscriptObjectPath="lib.mdNotificationsHasSeen" data="{recordKey:'pages', recordUid:'{data.uid}'}" />
Example for a news record:
<f:cObject typoscriptObjectPath="lib.mdNotificationsHasSeen" data="{recordKey:'tx_news_domain_model_news', recordUid:'{newsItem.uid}'}" />
Remove notification info
Remove the notification info as soon, as the user has read the item. Use the following code in your fluid template.
Example for a page record:
<f:cObject typoscriptObjectPath="lib.mdNotificationsRemove" data="{recordKey:'pages', recordUid:'{data.uid}'}" />
Example for a news record:
<f:cObject typoscriptObjectPath="lib.mdNotificationsRemove" data="{recordKey:'tx_news_domain_model_news', recordUid:'{newsItem.uid}'}" />
Console command
You can send reminder emails about notifications, which are not seen yet.
Therefor you will find a scheduler task called mdNotifications:reminder
.
Setup scheduler task:
- Go to
Scheduler
- Click
New task
- Select
Execute console commands
in theTask
-dropdown - Select
mdNotifications:reminder
in the dropdownSchedulable Command
- Add a value in the field
Frequency
- Press the
Save
button - Add value for
storages
. This is a comma separated list of IDs where the notification data is stored. - Add value for
listPageUid
. This is the Uid of the page, which holds the list of notification items. This page will be linked in the email. - Add value for
mailSubject
. The is the subject of the email, which will be sent. - Add optional value
mailTemplate
. With this option, your are able to set a templates for the task. Enter the name of the HTML file, which shall be used for the e-mail. - Press the Save button again
Hint:
You can setup individual tasks for individual notification types. Therefor
add more the one mdNotifications:reminder
-tasks and configure individually.
E-Mail template
In order to change the E-Mail template, add the path to your site extension in
global configuration in the section [MAIL][templateRootPaths]
. As soon, as you have added
the path to your extension, you can copy the Notifications.html
template from
Resources/Private/Templates/Email/
to your path and do your modifications.
Bugs and Known Issues
If you find a bug, it would be nice if you add an issue on Github.
THANKS
Thanks a lot to all who make this outstanding TYPO3 project possible!
Credits
- Extension icon was kindly taken from Font Awesome.