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

Plugin Problems

BeyBey
edited January 2012 in Vanilla 2.0 - 2.8

Background:

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.

Problem:

This worked for a while just fine but, when i wanted to test this plugin starting from scratch (a new database then enable the plugin) every time a redirect was called for, the Login page appeared even though the user was logged in (as indicated on the page where the login form was presesnted).

What would cause Vanilla to surmize that a login page should be displayed when a user is actually logged in?

Much appreciated

Tagged:

Best Answers

  • Options
    hbfhbf wiki guy? MVP
    Answer ✓

    for me it's been caused by something invalidating the session or cookie, like crossing between domains or something.

  • Options
    hbfhbf wiki guy? MVP
    Answer ✓

    Bey said:
    Thanks.

    Just in case there is something common between our cases, how did you resolve / get around your issue?

    I don't think domain crossing is relevant in my case as I test my plugin by clicking on urls in a Microsoft Word document.

    I am not sure about cookies but I did go through the exercise of deleting cookies and files using the browser Options.

    sorry i don't have a real answer for you on this. for me, when i am playing with my site and do something drastic, i have experienced an un-anticipated log-out. but this does not happen under normal, stable circumstances. i've not dug into it for myself since it seems to happen very infrequently, but i recall it happening when i made a change that modified the url of the site.

    Hopefully someone else will have more insight for you.

  • Options
    TimTim Operations Vanilla Staff
    Answer ✓

    Check your Garden.Cookie.* settings in your config. Make sure they match reality. Then clear all your own cookies, especially if you changed this setting.

    Vanilla Forums COO [GitHub, Twitter, About.me]

Answers

  • Options
    hbfhbf wiki guy? MVP
    Answer ✓

    for me it's been caused by something invalidating the session or cookie, like crossing between domains or something.

  • Options

    Thanks.

    Just in case there is something common between our cases, how did you resolve / get around your issue?

    I don't think domain crossing is relevant in my case as I test my plugin by clicking on urls in a Microsoft Word document.

    I am not sure about cookies but I did go through the exercise of deleting cookies and files using the browser Options.

  • Options

    Additional info following some more experimentation...

    I was able to get around this issue (on one workstation) by:

    1. Starting with a new database then doing some work on the site (adding categories, entering deleting some discussions, etc.)

    2. Logging out

    3. Logging in through phpadmin by clicking on the appropriate project link.

    After this sequence, the Login page did not appear when a user was logged on to the forum site.

    I cannot make much sense of it but, hopefully, some php/vanillla maven can.

  • Options
    hbfhbf wiki guy? MVP
    Answer ✓

    Bey said:
    Thanks.

    Just in case there is something common between our cases, how did you resolve / get around your issue?

    I don't think domain crossing is relevant in my case as I test my plugin by clicking on urls in a Microsoft Word document.

    I am not sure about cookies but I did go through the exercise of deleting cookies and files using the browser Options.

    sorry i don't have a real answer for you on this. for me, when i am playing with my site and do something drastic, i have experienced an un-anticipated log-out. but this does not happen under normal, stable circumstances. i've not dug into it for myself since it seems to happen very infrequently, but i recall it happening when i made a change that modified the url of the site.

    Hopefully someone else will have more insight for you.

  • Options
    TimTim Operations Vanilla Staff
    Answer ✓

    Check your Garden.Cookie.* settings in your config. Make sure they match reality. Then clear all your own cookies, especially if you changed this setting.

    Vanilla Forums COO [GitHub, Twitter, About.me]

  • Options
    BeyBey
    edited January 2012

    Thanks Tim, I will look into it.

    But, if I may fish for another tip in this direction because i think it has validity...

    Please consider that the setting I am working with is NOT any web site in which Vanilla is embedded.

    I am working with a wamp localhost server (listening on port other than 80 as I have IIS on that machine too). Vanilla with my plugin are installed on that machine. All my testing is done using a URL in Microsoft Word document in order to emulate a scenario that is not implemented yet - embedding Vanilla Forums in the application). When all issues are resolved, someone else (a developer) may do the embedding of Vanilla in the application which will have links that will generate and invoke those URLs .

    That means (I think) that there should be no cookies interference, but, again, I am NOT a web developer and have only conceptual understanding of what cookies are all about (preserving some state of a web session).

    Therefore, I am not sure what to look for in 'matching reality'. Also, I did not chage any configuration settings related to cookies (I did not know enough to be dangerous in this case).

    Much appreciated.

  • Options
    TimTim Operations Vanilla Staff

    I... I dont even...

    URL in Microsoft Word document

    Vanilla Forums COO [GitHub, Twitter, About.me]

  • Options
    BeyBey
    edited January 2012

    lol - Love your creativity and humor ...

    I know it is weird but, I have this project on my calendar to look into Vanilla Forums with a view towards embedding it in our web app. I am not a developer and have no access to the site nor the software. So, i came up with the idea of emulating someone clicking on a link resulting in the application generating then invoking such URL(s). For a long time i did not encounter any issue with this but then ... I did ... as noted above. As far as i could tell, it was similar to clicking on the link below where that link sits in a Word document:

    vanillaforums.org/discussion/18559/plugin-problems

    Except in my case the link was to my local host.

    Should this be an issue?

  • Options
    x00x00 MVP
    edited January 2012

    Why don't you ebbed a browser object in your app or am I misunderstanding?

    It is vile but possible to develop with office. some witchcraft called vba.

    The app, or object has to has to capacity to handle sessions and cookies.

    Note there are client sessions as well as user session. if you start a client with a new session/user it will not link that session to cookies for security reasons.

    There are also differences between how clients handle data like cookies.

    Also you might check that the server is not restarting itself for whatever reason.

    grep is your friend.

  • Options

    I didn't know Canadians watched carry on films.

    grep is your friend.

  • Options

    Thanks x00.

    I can use vba or even VB if needed but before i embark on another sub project in order to emulate a click on a URL i need to be convinced that this, indeed, is the issue.

    Since my plugin used to work fine using the link-in-doc mechanism before, i need to understand what it is that made it stopped working.

    I just don't see how issuing a url click from within vba code (or VB project) would make any difference.

    The Config Cookies approach seems much more relevant to me but, being a cookie initiate (as opposed to a cookie monster) I am not sure what i need to do - if any. Recall, there is no application in which Vanilla is embedded that generates cookies. All the cookies on my machine are generated by the local copy of Vanilla Forums and my general browsing activities on a workstation.

    Am i missing something obvious?

  • Options

    why don't you use javascript? In what context is the the link?

    grep is your friend.

  • Options

    if your server resets, then session data could be lost.

    The cookie might still be there. You can check this.

    grep is your friend.

  • Options
    BeyBey
    edited January 2012

    Thanx00 and Thanks Tim.
    Having created a test WordPress site from which to launch a URL to a VF site with my plugin this issue disappeared (as did another issue - reported in discussion Plugin Problems - Part 2).

    Your help is much appreciated.

Sign In or Register to comment.