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.

Plugin Problems - Part 2

edited January 2012 in Vanilla 2.0 - 2.8


I am a noob using Vanilla on a local host Win7 machine. I wrote a simple plugin that uses the DiscussionsController_Render_Before event to intercept an incoming url and either zoom in on a given discussion (add a comment to it) or start a new one within a category (derived from a variable in the URL). The DiscussionsController_Render_Before, based on the URL variables either does nothing or redirects to a new discussion page or to an existing discussion.


A previous post described a problem encountered with the redirection aspect, namely, the display of the Login page instead of the target page redirected to. However, when the redirection commences properly, there is still an issue with the posting of the new discussion in the 'Start a New Discussion' page (note: redirecting to an existing discussion works fine).

The problem is that when one clicks the Post Discussion button (afer both, title and body are populated), the form 'tries' to post the discussion (as evident from the animation to the left of the Cancel button) but the post is not completed and the page is redisplayed. At this point, if one just clicks the Post Discussion button again, the post commences and the discussion is saved to the database.

Here is an example of the New Discussion page being redirected to:


Here, 2 is the ID of the appropriate category for this particular case.

Please note that in some cases, the initial attempt to post WILL succeed: a) One refreshes the browser page prior to entering any data. b) One clicks the Preview button prior to clicking the Post Discussion button. (Seems like any action that results in reload of the page does the trick.) c) If there is another session in progress on the same machine, the new discussion will be posted on first try as well (most of the times, at least).

Any help in trying to figure this out is much appreciated.



  • Options
    edited January 2012

    In desperation (and having ran out of hair to pull) I got around this issue with the most mysterious solution.

    All I did is add a do-nothing function for the render after event:

    public function Base_Render_After($Sender) {

    // do nothing


    Problem gone...

    Not sure why this would make a difference but it did...

    Can anybody explain this??? Yours truly is rather curious :-D


  • Options

    Spoke too soon.

    After all, this 'solution' stopped working after a few successful tests.

    Plot is thickening. Back to hair pulling.

  • Options

    As it turns out, this behavior is related to the fact that the URL is NOT generated by a web site.

    I discovered this after creating a test WordPress web site where i embedded a test Vanilla Forum (not on the local host, of course) and used equivalent links from the WP site to the other Vanilla Forum with my plugin activated.

    So, a live and learn (alas, painful) experience with this hair pulling, etc.

Sign In or Register to comment.