XF 2.2 Throw error message in overlay

FoxSecrets

Active member
How can I throw an error message in overlay?

The code below returns in browser address bar not in overlay.

Code:
if (!$user) {
    throw $this->exception($this->error(\XF::phrase('user_not_found')));
}
 
You can't do this from the response itself (the response has no knowledge of or access to the previous page). You could maybe set data-xf-click="overlay" on whatever links to this page and then have it redirect to the final destination if there are no errors or something like that. Otherwise, this isn't something in the core.
 
Now I've found another issue.

When the error happens, I got it in overlay, however when running with no errors it should redirect to a page, and now I got in overlay as well.

Is there any workaround for this? Overlay just for the errors?
 
You should be able to use data-follow-redirects="on" on you link to prevent that, I think?
 
You should be able to use data-force-flash-message="off" (though that should be the default).
 
Are you running XF 2.2.15? I had sorted a bug you previously brought up that might have changed the behavior there.

 
I'm currently working on version 2.2.8, so it will probably not work, right?

As workaround is it possible to hide by css class? can you tell me what classes are attached to this message? I can't capture it.
 
Top Bottom