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.

URL problems

dudieboydudieboy New
edited April 2011 in Vanilla 2.0 - 2.8
Hi, embed Vanilla is working well enough on my site, with a few minor problems I'd like to start working on and need coding help. So when you click on a Discussion Title in the Discussions panel, in normal Vanilla it goes directly to the last post of the thread with a URL similar to this:

which is basically the same as the discussion URL with "s#Item_33" added to the end.

However in embed Vanilla, when you are viewing the forum through a WordPress page and click on a Discussion Title in the Discussions panel, it redirects you to a URL as follows:

The differences are that /vanilla/ (the default installation location) has been replaced by /forums/#/ which is the WordPress embedded page followed by a pound sign. Note that the "S" has been added to the end, but the "#Item_33" is missing. This URL redirects the user to a random spot about 1/3rd the way down the last page of the discussion, which is unacceptable.

However, when let the cursor hover over the discussion link, you see the correct URL, which is:

So it's obvious that an error is occurring in converting the default URL to the 'Remote URL to Forum'. In my embed Vanilla settings this is set to, however I don't check the option to "Force your forum to be viewed through the Remote Url" because I want mobile users to have the option of viewing the forums full screen, rather than embedded into my WordPress page.

In summary, I'd like to alter the code of the embed Vanilla plugin so that the Remote URL redirect doesn't cut the "#Item_33" from the end.

If possible, I'd also like to alter the WordPress Discussions widget so that the URLs link the user to the same location, the last post of the thread, rather than the first page of the discussion. If possible, I'd also like to add the name of the last poster to the Discussions widget, so that it would read something like "TV on DVD- What are you watching/wish to watch and how's it working for you? Last Post by Plopper".

Please let me know any ideas on how/where to begin.


  • Note that the "S" has been added to the end, but the "#Item_33" is missing.
    Yeah, but 's' is added by bug. Maybe fixes in next release.

    The rewrite URL produces for question mark a "s" in string in URL, why? - Vanilla Forums

    Anyway, here is quick & dirty hack. Sorry, no testing.
    Lets push and see what would happen.

    embedvanilla 1.0.1


                var hash = '';
    if (hashIndex > -1) {
    hash = path.substr(hashIndex);
    path = path.substr(0, hashIndex);
    /* comment out to keep fragment.
    var hash = '';
    if (hashIndex > -1) {
    hash = path.substr(hashIndex);
    path = path.substr(0, hashIndex);

          // pass the fragment to remote script.
    var components = window.location.href.split('#');
    if (components.length == 2) {
    remotePostMessage('scrollintoview:' + components[1].split('&')[0], '*');
    before the last two lines:


          } else if (message[0] == 'scrollintoview') {
    after the line:
             document.location = 'http://' + host + window.location.hash.substr(1);
  • @yu_tang Your changes have been implemented at and the full URL is now transferring to the address bar. However, if you click on one of the longer topics, such as the one near the top titled "TV on DVD- What are you watching..." you'll see that the URL still redirects to the middle of the page rather than the last post. :\

    What I'm starting to wonder is why Vanilla doesn't use the permalinks. The last post for the topic above has the following permalink URL: which is completely different (and much shorter) than which is supposed to go to the same location, but instead goes to just below the top of the page. The Vanilla version of this URL ( only works slightly better, going to the middle of the third post from the bottom. However, using the Permalink goes directly to the correct post, every time.

    So is there a way to modify Vanilla core and embed Vanilla so that discussion URLs redirect to the correct permalink rather than this seemingly abstract item reference?
  • Hmm...these js are tougher than I thought.
    Sorry, I have no alternative for now.
  • Sorry! I sincerely appreciate the try, though. :D

    I'm going to request help on switching to discussion/comment/ URLs on the Discussions page in another thread until someone else wants to chime in.
Sign In or Register to comment.