LibreBooking / app

Repository for the last open source version of Booked Scheduler. The "develop" branch contains the most current working code of the project and should be considered beta. The "master" branch is the most current stable release of BookedScheduler. Please read doc/README.md for further details.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatic users notifications

alepensato opened this issue · comments

Hi to all,
I am lokking for a solution that automatically preconfigure all users to receive email notification where someone create/update/edit a reservation. I found that these info are stored in the table user_email_preferences but I want that every users have these enabled by default.
How can I do this without making manual changes into the database?

There is no way to do this???

to solve this, that for me is a BIG issue, i made a crontab job that run every 2 minuter and do an insert into the user_email_preferences table

I am in the same boat I think. would like to have the "Notification Prefererences" set to " Send me an email" ON per default. Any way of doing that?

My workaround was to create a database trigger on user insert:

CREATE TRIGGER set_mail_prefs
AFTER INSERT ON users
FOR EACH ROW
INSERT INTO user_email_preferences VALUES
	(NEW.user_id, "reservation", "approved"),
	(NEW.user_id, "reservation", "created"),
	(NEW.user_id, "reservation", "deleted"),
	(NEW.user_id, "reservation", "participation_changed"),
	(NEW.user_id, "reservation", "series_ending"),
	(NEW.user_id, "reservation", "updated");

Every time a new user is inserted the trigger enables the e-mail notifications for all events.