Jump to content

Error trying to access a private message


Go to solution Solved by Nathan Explosion,

Recommended Posts

Posted

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}

 

Posted

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. 

 

  • Solution
Posted (edited)

Easily reproducible:

  1. Create an alert that requires the user to respond
  2. View the alert as a targeted user
  3. Send the required PM
  4. View the PM as the intended recipient - all good
  5. Delete the alert
  6. 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 by Nathan Explosion
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...