-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notification triggered when Craft saves draft #74
Comments
Hey there 👋🏻 Thank you for using our plugin first of all. You can use craft's element helper
With the plugin example:
|
Thank you for the quick response. When I add this code, I get the following error message in my logs. I'll do some additional troubleshooting, but if you have any ideas, I'd appreciate it. `2022-06-06 15:14website.test:39 [-][1819][i043i8idaebs4cqmmt9edq3vea][error][yii\base\ErrorException:2] yii\base\ErrorException: Invalid argument supplied for foreach() in /home/staging-snqfd/website.test/vendor/percipioglobal/craft-notifications/src/services/NotificationsService.php:89 #0 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/web/ErrorHandler.php(84): yii\base\ErrorHandler->handleError() #1 /home/staging-snqfd/website.test/vendor/percipioglobal/craft-notifications/src/services/NotificationsService.php(89): craft\web\ErrorHandler->handleError() #2 /home/staging-snqfd/website.test/vendor/percipioglobal/craft-notifications/src/Notifications.php(97): percipioglobal\notifications\services\NotificationsService->send() #3 [internal function]: percipioglobal\notifications\Notifications->percipioglobal\notifications{closure}() #4 /home/staging-snqfd/website.test/vendor/yiisoft/yii2/base/Event.php(312): call_user_func() #5 /home/staging-snqfd/website.test/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger() #6 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/base/Element.php(4148): yii\base\Component->trigger() #7 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/elements/Entry.php(1680): craft\base\Element->afterSave() #8 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/services/Elements.php(2716): craft\elements\Entry->afterSave() #9 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/services/Elements.php(785): craft\services\Elements->_saveElementInternal() #10 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/services/Drafts.php(268): craft\services\Elements->saveElement() #11 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/controllers/EntryRevisionsController.php(169): craft\services\Drafts->saveElementAsDraft() #12 [internal function]: craft\controllers\EntryRevisionsController->actionCreateDraft() #13 /home/staging-snqfd/website.test/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array() #14 /home/staging-snqfd/website.test/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams() #15 /home/staging-snqfd/website.test/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction() #16 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module-
#17 /home/staging-snqfd/website.test/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction() #18 /home/staging-snqfd/website.test/vendor/craftcms/cms/src/web/Application.php(278): yii\web\Application->handleRequest() #19 /home/staging-snqfd/website.test/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest() #20 /home/staging-snqfd/website.test/public/index.php(24): yii\base\Application->run()` |
@AdamChlan having an example of your code would be very helpful! |
Sure, here is the entire file.
|
Thank you @AdamChlan for the code example, we'll set it up and see if we encounter any issues and do a bug fix if there is something off. |
Hi @michtio , I was curious if you ever had a chance to test this out? |
hi @AdamChlan, Sorry that we didn't reply earlier on your message. Can you try this Return an empty array in the via method (so update the return to return []) <-- this was our bad
|
I'm curious if there is a way to not have a notification be sent when Craft saves a draft of the post in the admin. The plugin is working just as I need otherwise. Thank you.
The text was updated successfully, but these errors were encountered: