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.

WhosOnline: Whole Forum in Sidebar (Solved)

edited September 2010 in Vanilla 2.0 - 2.8
When I enable this plugin, I get the entire forum 'duplicated' over in the right hand column where I expect to see the list of Who's Online. It's obviously really ugly, making the plugin sadly unusable.

I tested this in both Chrome and IE8 with the same results.


  • Hate to bump my own post, but this plugin is marked as being "approved" and doesn't seem to even work. Can we at least get it 'unapproved'?
  • edited August 2010
    Ok. Doing some experimenting, I went to play with class.whosonlinemodule.php and I think it's something with the ToString() function that's causing the problem. If change that function to return something else, it prints whatever text I put there.

    Could this be an issue with not using friendly urls? That might explain why the sidebar gets 'redirected' to the main messagelist.

    It seems that the ob_start() and ob_get_contents() aren't quite doing what they should. It appears that for some reason that I can't figure out, ob_get_contents() is retrieving the entire page rather than just the bit of code above it like I would expect.
  • edited August 2010
    Okay. After a lot of experimentation, I discovered that if I remove the id="WhosOnline" part from the div, it works fine. I'm not sure if the js is auto-updating it (that may be relying on the id).

    Any idea why the id would cause the entire page to repaint? Should I be looking in the js for the answer to this question?

    Further experimentation shows that the js is the problem. It is requesting the url WEB_ROOT/plugin/imonline which isn't a valid path, hence being redirected to the main site and having it print in the sidebar.

    Question is, what url is it *supposed* to be reaching for in order for the ajax to work correctly?
  • I will look into it (my plugin after all) however it works fine for me.
  • edited August 2010
    @garymardell: Thanks. Should WEB_ROOT/plugin/imonline be a valid URL? It's certainly not on my server, so it makes perfect sense that the javascript would be throwing up on it. It can't request ajax to a url that doesn't exist. The plugin directory is called "plugins" with an 's', so right off the bat that URL looks suspicious to me.

    The javascript very clearly calls out to that URL. Perhaps it is supposed to be created somehow? Could it be a permission issue? A config issue?

    Does it rely on rewrite rules at all? I don't have Friendly URLs turned on and I'm using Lighttpd instead of Apache.

    It just seems like this should be a straightforward issue. That URL either exists for the javascript or it doesn't. I just have to figure out why it doesn't and what it is that I need to do to make that URL resolve. Could it be a Vanilla Route that should be created but isn't?

    Can you verify that the javascript file that you have on your working copy is the same as what's in the repository to download from the site?
  • Its probably a friendly url issue, i will use the functions for the url and everything should be fixed, should see it done by tomorrow.
  • Try upgrading to the latest 2.0.4
    Fixed AJAX issues that broke functionality when RewriteUrls was disabled
  • @garymardell: thanks. i'll upgrade to 2.0.4 and see if I have any luck. i'd like to use friendly URLs, but I'm using Lighttpd and I haven't gotten quite everything to work with the rewrite rules yet.
  • TimTim Operations Vanilla Staff
    2.0.6 now ;)

    Vanilla Forums COO [GitHub, Twitter,]

  • edited September 2010
    Update: I upgraded to 2.0.6 but that didn't fix my problem. Since I'm not using friendly URLs, the javascript is requesting WEB_ROOT/plugin/imonline which my server does not serve.

    Now that I have a better understanding of what's going on, I was able to figure out that all I had to do to fix the javascript is to change line 4 to:

    var url = gdn.combinePaths(webRoot, '/index.php?p=/plugin/imonline');
    I'm sure it works fine with friendly URLs. Unfortunately, none of the Lighttpd rewrite rules that I've found have fully worked and I've had no luck writing my own. It mostly works, but the pop-ups (like change picture) say page not found when I turn them on. /shrug

    At any rate, if anyone else is in my boat, that's the solution. It's actually quite obvious now that I understand friendly urls better. Ideally, this addon would honor the friendly URLs setting somehow.
  • TimTim Operations Vanilla Staff
    I think we'll be implementing the Url() function that we use on the server side, in Javascript. That will allow us to do something like:


    That call will generate the appropriate link based on your RewriteUrls setting.

    Vanilla Forums COO [GitHub, Twitter,]

  • edited September 2010
    @Tim: That sounds like a good plan! Thanks.

    Until that time, it seems like it would be good practice for Plugin developers to always reference the unfriendly URL in ajax. If friendly URLs are enabled, the request will be rewritten anyway.
  • I can just change it so i use the Url function in php and use it as a Defintion for the javascript.
  • TimTim Operations Vanilla Staff
    We had talked about this last week and @Todd actually added this already. It is available in 2.0.6 as gdn.url() in Javascript. It only takes 1 parameter (like my example above).

    Go nuts :)

    Vanilla Forums COO [GitHub, Twitter,]

  • @garymardell, @Tim: Sounds like an easy enough fix now! Thanks for the help... hopefully my investigative work was not all in vain.
  • Thanks guys, i will definitely include the fix in a second.
  • Sorry to bring this up, but it appears the problem's resurfaced.

    WhosOnline: 1.3

    When the page initially loads you can see a "who's online" section, but then the whole forum page is loaded into the sidebar, which then loads the whole forum page into its sidebar, and so and so on, creating a recursive loop.
  • lucluc ✭✭
    edited May 2011
    Which theme?
    It might be missing the Foot asset.
  • ShmizzleShmizzle New
    edited November 2011
    @luc was on to something. I made sure the inside of the tags in my theme's .tpl files contained an {asset name="Foot"} so it looks something like this:

    ... {asset name="Foot"} ...

    And that fixed it, without needing to use Lykaon's modification (which caused other problems for me).
Sign In or Register to comment.