Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted December 4, 20186 yr While implementing this code for getting secondary groups, my localhost instance through this whoops exception: Is there something else that I need to do to get this line to work //\IPS\Output::i()->error( 'node_error', 'YOUR_ERROR_CODE', 404, '' ); ? It seems it's looking for a template, but a directory doesn't exist?
December 5, 20186 yr Doesn't seem to be related to the code that you linked to in the other topic. This isn't related to directories. This is you (or someone) song something like $obj->directory, but $obj is not an object. Without seeing the actual hook code, I can't be more specific.
December 5, 20186 yr 15 hours ago, JimBurnett said: Is there something else that I need to do to get this line to work Why do you need that line? Remove it
December 5, 20186 yr On the surface, it appears that the problem is you are attempting to throw an error (the code you commented out) before the dispatcher has actually finished initializing. Because of this, $this->application within the dispatcher has not been set yet, and so later when \IPS\Dispatcher\Front::i()->application->directory is called (during output) it throws an error. You should essentially never need to throw an actual error message when writing an SSO plugin (which I assume is what you are doing based on the stacktrace you provided). If it is imperative to show an error, you should probably set a session variable or similar, and add another hook later in the code execution that picks this up and shows the error after the dispatcher is initialized.
December 5, 20186 yr Author Ok thanks. I don't think I need to throw the error really, I was just trying to use the code as-is that adriano provided. Thank you all for the responses & bfarber for the explanation -- you are right, I'm writing an SSO plugin. I appreciate the help.
Archived
This topic is now archived and is closed to further replies.