XF 2.2 Is it possible to reload the page after a redirect?

AndyB

Well-known member
In my PHP code I call the following:

PHP:
return $this->redirect($this->buildLink('index'));

Is it possible to reload the page after the redirect.

Thank you.
 
Simple idea... Pass parameters, then load a js code in the template...A condition that outputs a js reload through the parameter.
 
Reloading the page after a redirect, by its nature, is the default behaviour.

You can opt out of this behaviour if it is an AJAX submitted form by adding data-redirect="off" to the form element in the HTML. So if it isn't redirecting you likely just need to remove that on the HTML form.
 
Hi Chris,

Thank you for taking the time to explain the general behavior. In this particular case what I'm doing with an add-on is to update the Approval queue, for example mass deleting all unapproved posts. I'm using the same code which is used by XenForo and the posts in the Approval queue are deleted, but no matter what I do the Approval queue count:

1614709322876.webp

which is showing 2 in this image example is not updated until the page is reloaded.
 
It's fair to say that since XF 2.1 the approval queue is quite a special case because it processes the queue as a type of job so it can better handle more items and slightly more strenuous work, such as running the spam cleaner.

I suspect there's a wider issue with your code but it's hard to say without more info.
 
Thanks again, Chris.

I'll just explain in the confirm landing page that a page reload is required before an accurate Approval queue count is shown.
 
Back
Top Bottom