Lee
Well-known member
This implementation gives a small error when push notifications are enabled. Does anybody know what the fix is for this please?If you've ever created a custom content type within XenForo you may have been tempted to add reactions (or formerly Likes) to them but perhaps been concerned that it might be difficult to implement them with your custom code, but if so, your fears were unwarranted.
Reactions are a great way to improve user engagement and interaction, so let's add them to our notes! You may be surprised at just how quick and easy it is to do.
In fact, here in Part 14 of Building with XenForo 2, we implement reactions for our notes content items in just over twenty minutes, including the time it takes for @Kier to waffle on about technical details!
Necessarily, this video also touches on the use of content type fields to provide thereaction_handler_class
identification for thedemo_pad_note
content type...
Error:
- Error: Call to a member function getPushTemplateName() on null
- src/XF/Service/Alert/Pusher.php:53
- Generated by: Lee
- Jan 5, 2022 at 12:58 AM
Trace:
Stack trace
#0 src/XF/Service/PusherTrait.php(187): XF\Service\Alert\Pusher->getNotificationBody()
#1 src/XF/Repository/UserAlert.php(163): XF\Service\Alert\Pusher->push()
#2 src/XF/Repository/UserAlert.php(101): XF\Repository\UserAlert->insertAlert(3, 1, 'Lee', 'tls_thoughts_th...', 22, 'reaction', Array, Array)
#3 src/XF/Reaction/AbstractHandler.php(186): XF\Repository\UserAlert->alertFromUser(Object(SV\ReportImprovements\XF\Entity\User), Object(SV\ReportImprovements\XF\Entity\User), 'tls_thoughts_th...', 22, 'reaction', Array)
#4 src/XF/Repository/Reaction.php(201): XF\Reaction\AbstractHandler->sendReactionAlert(Object(SV\ReportImprovements\XF\Entity\User), Object(SV\ReportImprovements\XF\Entity\User), 22, Object(TLS\Thoughts\Entity\Thought), 1)
#5 src/XF/Repository/Reaction.php(142): XF\Repository\Reaction->insertReaction(1, 'tls_thoughts_th...', 22, Object(SV\ReportImprovements\XF\Entity\User), true, false)
#6 src/XF/ControllerPlugin/Reaction.php(65): XF\Repository\Reaction->reactToContent(1, 'tls_thoughts_th...', 22, Object(SV\ReportImprovements\XF\Entity\User), true)
#7 src/XF/ControllerPlugin/Reaction.php(19): XF\ControllerPlugin\Reaction->actionToggleReaction(Object(TLS\Thoughts\Entity\Thought), 'thought/reactio...', 'thought')
#8 src/XF/ControllerPlugin/Reaction.php(12): XF\ControllerPlugin\Reaction->actionReact(Object(TLS\Thoughts\Entity\Thought), 'thought', 'thought/react', 'thought/reactio...')
#9 src/addons/TLS/Thoughts/Pub/Controller/Thought.php(149): XF\ControllerPlugin\Reaction->actionReactSimple(Object(TLS\Thoughts\Entity\Thought), 'thought')
#10 src/XF/Mvc/Dispatcher.php(350): TLS\Thoughts\Pub\Controller\Thought->actionReact(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('TLS\\Thoughts:Th...', 'React', Object(XF\Mvc\RouteMatch), Object(TLS\Thoughts\Pub\Controller\Thought), NULL)
#12 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(TLS\Thoughts\Pub\Controller\Thought), NULL)
#13 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2344): XF\Mvc\Dispatcher->run()
#15 src/XF.php(512): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}
I followed the development video from Kiers series and the result is this error, when push notifications are enabled.
Does anybody have any information that can point me in the correct direction for fixing this please?
Additionally, I am curious as to the correct way to actually trigger an alert upon reaction. Can anybody share some information on how to achieve this please?
Thank you.