bernhard Posted April 21, 2020 Share Posted April 21, 2020 Today one of my dearest customers "Claudine" has her 50th birthday!! ?? She works a lot with their PW-based Software and I thought it would be nice to show her a birthday popup on the next login: RockBirthday ProcessWire module to show a happy birthday message within a given period after birthday. Usage Just install the module and customize it via hooks in /site/init.php (not ready.php!) // dont show message after set maxDays $wire->addHookAfter("RockBirthday::setConfig", function($event) { $event->object->maxDays = 30; // 14 is default }); // get date of birth of user // must return a timestamp (int) $wire->addHookAfter("RockBirthday::getBirthdate", function($event) { $user = $this->user; $event->return = $user->getUnformatted('your_birthdate_field'); }); // get markup of message $wire->addHookAfter("RockBirthday::getMarkup", function($event) { $user = $this->user; $html = "<h1>Happy Birthday, {$user->name}!</h1>"; $event->return = "<script>vex.open({unsafeContent: \"$html\"});</script>"; }); https://modules.processwire.com/modules/rock-birthday/ https://github.com/BernhardBaumrock/RockBirthday 4 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now