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.

Comments login loading full page not embed

Hi all,

I've been using Vanilla as a comments system for Wordpress for a while now, and just spotted an issue that's cropped up on our server. Not entirely sure when it began, but if a user logs in through comment box under a blog post (not through the forum homepage) the iframe for the comments is reloading the whole page rather than just the comments.

The src reference for the iframe itself doesn't change, so I assume it's a redirect issue once a user has entered mail/password.

The first call after logging in is for the URL of the full page, not the discussion/embed link (which still appears in the iframe tags). Using 2.2.1.

Has anyone had anything similar?

«1

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Yes this has occurred to others before but can't pin point a solution. We need you to create an admin account for the forum so we can try to log in and experience the issue, inspect the code and try to help out fixing it.

  • Thanks @vrijvlinder Happy to that. Shall I DM details to you?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Yes, send me the details via private message and as soon as I get a chance I will look into your problem.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited August 2016

    Ok , I changed my name to TestAdmin because I don't want my name to come up on searches other than my websites.

    I changed the theme to the default, because the css of the one you were using was bad.

    The issue has to do with WP and the way you embedded the forum in that page. The link you added to the menu of the WP goes to the stand alone forum. Not to the embedded forum.

    You would need to use a different link to the page where you embedded the forum on the WP website.

    If htxt.co.za is the WP main site then the forum url if embedded must be htxt.co.za/forum or whatever name you give the forum page.

    If this forum.htxt.co.za is the stand alone forum , that is what you will get if you use the link to that. It does not redirect , it is not supposed to.

    I would need to see how you embedded into WP .

    The best way is to make a new page and add a div and then the embed code. Embedding is tricky there may be adjustments needed both in CSS and JS.

    I suggest you don't embed and make the forum look just like the WP site. I can help with that. I recommend you use the CSSEDIT plugin in your forum because it makes it easier to edit css right from the dashboard, but it requires php 5.4 or higher.

    This link works to load the forum in your WP

    http://www.htxt.co.za/forum/

    Simply change that link in the menu for WP that you have to this one.

    Also there are some elements from your WP theme that are interfering with the buttons of the embedded forum. You will need to fix that WP theme so it does not interfere .

    I was able to log in from the embed and also post a test discussion, I was able to log out and still be in the embed forum. The comments load in the blog without issues.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited August 2016

    It looks as though the entire WP page needs to be refreshed in order to clear the WP iframe that gets generated where the comments are supposed to load.

    If the page is refreshed then it all works well so I think something is not making the page refresh automatically , only the comments…

    It does refresh the entire page when logging out. So it must have to do with the WP plugin…

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited August 2016

    There are ways to force the parent page of an embedded iframe by adding this script to the default.master.tpl of your vanilla theme

    It should refresh the entire page when you close the sign in popup.

    place this script in the foot of the default.master.tpl  before the </body>
    
    
    
       {literal}<script type="text/javascript">
    
    window.onunload = refreshParent;
                function refreshParent() {
                    window.opener.location.reload();
                 }
    </script>{/literal}
    
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I found this for WP , obviously it needs to use the element name or id instead of Fancybox

    <script type="text/javascript">
    jQuery(document).on('fancybox-cleanup', function() {
        location.reload();
    } );
    </script>
    

    https://wordpress.org/support/topic/reload-parent-page-after-fancybox-auto-iframe-closes

  • Thanks @vrijvlinder. Issue is still there, sadly - but hammering away trying to find the cause. Something in the embed.js I think.

  • edited August 2016

    It's an issue with vanilla forum update or the latest wordpress vanilla comments plugin update they did.

    Problem lies in it's "link" code, somewhere. There are several link issues with wordpress comments:

    • not redirecting after sign in
    • opening links in iframe inside wordpress comments
  • @MarcusMaximus Yeah - tbh I think I'm just going to switch to non-pop up signin. We had a similar issue a while ago and the last major release fixed it. With 2.3 just around the corner I'm going to assume it's an update in something else which has borked it and wait to get latest Vanilla for compatibility

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @adamoxford said: I'm going to assume it's an update in something else which >has borked it and wait to get latest Vanilla for compatibility

    The word is smatched… I suggest you do not wait for 2.3 and try to find a solution. because it took several years to go from 2.0 to 2.1 and then 2.2…

    This is free software you host. Do not expect people to work for free so you can benefit …this is the case with any open source software, even WP. People are giving you free software and you ask for solutions that could be your fault for the problems.

    Look at the js errors in your web inspector and you will find out your problems… they have little to do with Vanilla software, if you take the time to find out why you are having certain problems ….

    This software is the most user friendly software any idiot can learn to write for. I am that idiot that tested everything until I found Vanilla… get with the program and learn something. Don't wait for others to solve something you are the cause of…

    I have had no issues such as you describe with my own installations and the web inspector finds no errors. Until you can say the same… the fault lies with your installation…

  • @vrijvlinder I'm sorry I seem to have upset you. I'm very grateful for the time you took to look at our issue. Trust me, I don't expect anyone to work for free at all. I take complete responsibility for the fact we need to sort out own issues out.

    All I meant was that I'm not, first and foremost, a coder. I'm a journalist on a small media startup, and the moment I can afford to hire someone to look after the site maintenance (and pay Vanilla for hosting), I will. I like Vanilla, though, and have enjoyed using it so far.

    I was sharing our experience partly in the hope someone had a similar issue and managed to fix it, and failing that in the hope that it would help others if similar issues arise. Like I say - it was working fine, something else has updated (Wordpress? Apache? PHP? Ubuntu? - all these changed before we spotted the login bug) and affected Vanilla. The trouble is, I don't really have the skill & time to figure out which is causing it. And if it is a Vanilla compatibility thing, as 2.2 is now in maintenance mode pending 2.3 release I wouldn't expect the devs to be spending any time to try and fix it anyway.

    Personally, I think the issue we have may down to the fact the comment embed tries to load in https, but gets rejected on login redirect because the page it's embedded in is http. All the errors thrown up in Chrome's console, for example, are "protocol mismatch". But I'm afraid I can't be sure as it's way above my understanding - I think this makes sense because it looks like Vanilla's login would reload the page (within the iframe?) if it can't find the target, but I'm not a JS dev so can't be sure. All I can do is throw the experience out there for others to learn from, which as far as I know is the open source way to help.

    Or it could be this onloadwff.js error, "locked a frame with origin "http://forum.htxt.co.za" from accessing a frame with origin "http://www.htxt.co.za". Protocols, domains, and ports must match".

    Either way, Vanilla is about to revamped and our Wordpress site is being redesigned and updated to force https anyway, so if the quick temporary fix is to disable popups, that's what I'll do.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I am sorry I did not mean to snap at you… it was late

    Yes there is an error is caused by blocking of js because it is calling an iframe not from the same domain. I don't think that would affect too much since it does load after a refresh.

    Even if you do not use popups this happens, I tested with and without popups. The only solution is to force the Parent page to reload.

    It is a matter of testing this code with the proper function and find where this would work. I think putting this in your Vanilla template might work. I will test it on my own install as soon as I get a chance.

        {literal}<script type="text/javascript">
        jQuery(document).on('Close', function() {
            location.reload();
        } );
        </script>{/literal}
    
  • Hi Vrijvlinder - no problem. Was just just mortified I'd offended.

    Thanks for that snippet. Trying it in a few places to see where it works. Have you got a link to another Wordpress site with embedded comments? I want to compare behaviour and the sign in links generated where it works and where it doesn't.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @adamoxford said:
    Hi Vrijvlinder - no problem. Was just just mortified I'd offended.

    No, even if you had offended I would still try to help…. your problem is a real enigma that makes me want to figure it out. Which in turn makes me learn something I don't know.

    Have you got a link to another Wordpress site with embedded comments?

    I have embedded forum, however I don't have the same issue exactly because it is the entire forum embedded in a WP page.

    I want to compare behavior and the sign in links generated where it works and where it doesn't.

    When a person signs out from the embedded comments the parent page refreshes automatically , which should happen when a person signs in as well. If this could be made for the sign in too , the problem would be fixed.

    Maybe you can file a report at github for the Vanilla developers. Although that may take time you might not have. And doing so does not guarantee they will get to it soon because they have priorities. Free software has it's benefits and it's cons… You just can't kick a gift horse in the mouth regardless…

    A parent refresh is needed upon login, that is obvious, why it happens upon sign out but not upon sign in, I don't know. I think it should.

    Otherwise it loads the parent page in the frame instead of the comments form and that is unacceptable when touting software to work for it's intended optional purposes. Vanilla Comments embedded into a blog.

    Because this does not happen to other software used for comments on a blog typically … I tested Disqus comments and it worked well and refreshed the Parent page in and out . Since you mentioned to me that you just want to use the comments and do not care about using a forum, maybe Disqus is a better option for you. Vanilla is awesome forum software, not sure it is the best for blog comments due to the many people who seem to have the same problem.

  • Heh. I should log an issue in Github, but a) I suspect that with focus on 2.3 and the fact it's on a non-core feature it'd very low priority and b) I've spent so long trying to fix it now I'm getting bloody minded about it. Also, as you've said before, it's probably not a core Vanilla problem but a conflict with something else (an older version of Jquery? Newer version of PHP? One of the analytics cookies/ad server scripts?).

    The thing is that the expected behaviour (how it worked before) was that on login it didn't trigger a full page refresh. I don't think it even refreshed the full iFrame. Will keep fiddling...

  • Have logged a Github issue anyway - stupid not to I guess.

    One further bit of info for anyone also trouble shooting this:

    • This is affected by changing the embed forum settings in the Vanilla dashboard. If the WP site is added to the list of trusted domains for embedding, the iFrame refreshes with the current page.

    If the WP site is not listed (ie. field left blank to allow embedding anywhere) the page loaded in the iframe is the forum homepage.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @adamoxford said:
    Have logged a Github issue anyway - stupid not to I guess.

    One further bit of info for anyone also trouble shooting this:

    • This is affected by changing the embed forum settings in the Vanilla dashboard. If the WP site is added to the list of trusted domains for embedding, the iFrame refreshes with the current page.

    If the WP site is not listed (ie. field left blank to allow embedding anywhere) the page loaded in the iframe is the forum homepage.

    Very interesting , however then why would it load comments correctly after refreshing , and do so again after log off.

    There were some changes and it could be php or jquery , hard to say… It is a real enigma.

  • I'm trying to use Vanilla 2.2.1 as a comments system with CodeIgniter and having this same issue.

    My first attempt to fix this I wanted to add target="_top" or target="_parent" into the form action of the Vanilla login form. Basically change:

    <form id="Form_User_SignIn" method="post" action="/vanilla/index.php?p=/entry/signin">
    

    to:

    <form id="Form_User_SignIn" method="post" action="/vanilla/index.php?p=/entry/signin" target="_top">
    

    However, I was not able to figure out out to modify this output for the SignIn form in Vanilla.

    As a workaround I created a breakout_of_frame() javascript function that is called using body onload in the web page that is using the embedded Vanilla comment system as described @ https://www.thesitewizard.com/archive/framebreak.shtml

    So far this seems to be working.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @infinigrove said:
    I'm trying to use Vanilla 2.2.1 as a comments system with CodeIgniter and having this same issue.

    My first attempt to fix this I wanted to add target="_top" or target="_parent" into the form action of the Vanilla login form. Basically change:

    <form id="Form_User_SignIn" method="post" action="/vanilla/index.php?p=/entry/signin">
    

    to:

    <form id="Form_User_SignIn" method="post" action="/vanilla/index.php?p=/entry/signin" target="_top">
    

    However, I was not able to figure out out to modify this output for the SignIn form in Vanilla.

    As a workaround I created a breakout_of_frame() javascript function that is called using body onload in the web page that is using the embedded Vanilla comment system as described @ https://www.thesitewizard.com/archive/framebreak.shtml

    So far this seems to be working.

    You need to add the URL of the embedded forum into the safe urls or trusted urls of the settings for embedding in the dashboard. The urls must match. Otherwise it loads the whole thing until you refresh.

    This is affected by changing the embed forum settings in the Vanilla dashboard. If the WP site is added to the list of trusted domains for embedding, the iFrame refreshes with the current page.

    Also , ReWriteUrl must be enabled for many things to work properly.

Sign In or Register to comment.