Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to redirect "AfterDiscussionSave" to the discussions overview page

RhoRho
edited September 2011 in Vanilla 2.0 - 2.8
Hello,

I would like to redirect the browser to the /categories/discussions page after the "Post Discussion" button is pressed, instead of redirecting into the discussion text.

So when a user posts a discussion, he/she is returned to the page showing all the discussions. Since no one will reply to a new dicussion instantaneously, there is no reason to redirect to this.

I read that there is a trigger "AfterDiscussionSave", but how to link a redirect to the categories/discussions page?

Thoughts and suggestions are most welcome!

Best Answer

  • Options
    LincLinc Detroit Admin
    Answer ✓
    In my experience, it's nice to view the discussion immediately after creating it to confirm that A) It worked and B) It looks right. I hate software that forwards me back to the index.

    Also note that the AfterDiscussionSave trigger will fire any time the discussion is edited, which may have unintended consequences if you always redirect there.

    There is a 'Redirect' function you can use to do this. Follow the plugin quickstart guide and make a _Handler method for whatever hook you want to use, then call 'Redirect' to wherever you want to send them.

Answers

  • Options
    LincLinc Detroit Admin
    Answer ✓
    In my experience, it's nice to view the discussion immediately after creating it to confirm that A) It worked and B) It looks right. I hate software that forwards me back to the index.

    Also note that the AfterDiscussionSave trigger will fire any time the discussion is edited, which may have unintended consequences if you always redirect there.

    There is a 'Redirect' function you can use to do this. Follow the plugin quickstart guide and make a _Handler method for whatever hook you want to use, then call 'Redirect' to wherever you want to send them.
  • Options
    Hello Lincoln, thank you for the information.

    In principle I agree with your comments, but my intended use is not as a regular forum. I want to use the forum as a logbook, where each discussion (subject) is an event and the actual content of the discussion is not really used other than to contain an attachment (optionally to add comments, but not likely).

    The timeframe will be a matter of hours, with many new discussions (events) being posted. So, going back to the discussion overview automatically is in fact desirable, so the users can stay up to date without an extra click.

    I will look into the _Handler method that you suggested.

    Kind regads,

    Rho
Sign In or Register to comment.