This guide will show you how to setup BookStack to send an email notification, when an entity changes, to anyone who marked the entity as a favourite.
Create the files below in your bookstack/themes/custom/
folder.
The favourite_notification.php
must be in the folder `themes/custom/resources/lang/en/'. Add other languages as needed.
Add the theme to your .env
file:
APP_THEME=custom
Add the namespace to your composer.json
autoload section:
{
"autoload": {
"psr-4": {
"Custom\\": "themes/custom/"
}
}
}
Finally run composer update
to generate the autoload.php
.
- Favourite an entity (shelf, book, chapter, page)
- Edit the entity, then save
- An email will be sent
This code was sponsored by Aussie Broadband: Australia's Leading nbn™ Internet Provider
In 23.08 I'm getting this error message:
production.ERROR: Custom\SendFavouriteNotification::Custom{closure}(): Argument #1 ($favourite) must be of type BookStack\Actions\Favourite, BookStack\Activity\Models\Favourite given {"userId":3,"exception":"[object] (TypeError(code: 0): Custom\SendFavouriteNotification::Custom\{closure}(): Argument #1 ($favourite) must be of type BookStack\Actions\Favourite, BookStack\Activity\Models\Favourite given at /config/www/themes/custom/SendFavouriteNotification.php:28)