Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
JimBurnett Posted December 4, 2018 Posted December 4, 2018 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?
HeadStand Posted December 5, 2018 Posted December 5, 2018 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.
newbie LAC Posted December 5, 2018 Posted December 5, 2018 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
bfarber Posted December 5, 2018 Posted December 5, 2018 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.
JimBurnett Posted December 5, 2018 Author Posted December 5, 2018 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.