David N. Posted October 18, 2022 Posted October 18, 2022 When I try to access a specific private message I get the following error: Error: Call to a member function forMember() on null (0) #0 /home/logicpro/public_html/system/Dispatcher/Controller.php(118): IPS\core\modules\front\messaging\_messenger->manage() #1 /home/logicpro/public_html/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute() #2 /home/logicpro/public_html/applications/core/modules/front/messaging/messenger.php(67): IPS\Content\_Controller->execute() #3 /home/logicpro/public_html/system/Dispatcher/Dispatcher.php(153): IPS\core\modules\front\messaging\_messenger->execute() #4 /home/logicpro/public_html/index.php(13): IPS\_Dispatcher->run() #5 {main}
Marc Posted October 18, 2022 Posted October 18, 2022 Please could you provide a link to that message and let us know the user you are logged in as? David N. 1
David N. Posted October 18, 2022 Author Posted October 18, 2022 I was logged in as myself. The user was a spammer, so I've deleted him, so unfortunately I no longer have a link to his private message. I believe it's possible that when I tried to access the private message, the spammer had deleted it.
Marc Posted October 18, 2022 Posted October 18, 2022 All I can really suggest at this point, is to let us know if you see this happen again. We can then take it a look at that point in time
Solution Nathan Explosion Posted October 18, 2022 Solution Posted October 18, 2022 (edited) Easily reproducible: Create an alert that requires the user to respond View the alert as a targeted user Send the required PM View the PM as the intended recipient - all good Delete the alert View the PM as the intended recipient - yep, it's f.... I've got 3 PMs on my test site that have this issue - and I know they are all associated with my alert testing, and all my alerts are since deleted. Stick a var_dump($conversation->alert); in before this, and you'll get NULL for a normal PM, and an integer for a PM that came as a result of an alert: if ($conversation->alert) { try { $alert = \IPS\core\Alerts\Alert::load($conversation->alert); } catch (\OutOfRangeException $e) { } if (!$alert->forMember(\IPS\Member::loggedIn())) { $alert = NULL; } } Edited October 18, 2022 by Nathan Explosion SeNioR-, Marc, David N. and 1 other 4
Marc Posted October 18, 2022 Posted October 18, 2022 Thanks Nathan. Have reported that internally as a bug David N. and SeNioR- 2
David N. Posted October 19, 2022 Author Posted October 19, 2022 Indeed this was a PM that was responding to an alert. Thank you @Nathan Explosion! Marc 1
Recommended Posts