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

How could I put a link in the unembedded vanilla to go to embedded vanilla?

peregrineperegrine MVP
edited March 2012 in Vanilla 2.0 - 2.8

Users can access our forum via wordpress
http://www.example.com/discussions-3/#/discussions

or non-embed

http://www,example.com/discuss/

I added a link to the banner menu in vanilla e.g. WPHOME

The link works fine when one is in the unembedded version and takes you to the embedded version.

However, because the embed is an iframe, if a user clicks on WPHOME while within the embedded version. There is recursion and the wordpress menu gets thrown within the iframe.

Is there a way to solve this without a redirect? If not what would be the best way to do the redirect.

I tried looking in remote.js to solve this but don't quite understand some of the variables e.g. foreign (could this be the clue).

same problem with custom pages.

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Best Answer

  • Options
    x00x00 MVP
    Answer ✓

    you can use a wordpress plugin the breaks out of iframes, it is also useful for those that may use your site for spurious means

    grep is your friend.

Answers

  • Options
    x00x00 MVP
    Answer ✓

    you can use a wordpress plugin the breaks out of iframes, it is also useful for those that may use your site for spurious means

    grep is your friend.

  • Options
    x00x00 MVP
    edited March 2012

    If you are using the embed friendly theme

    {if isset($smarty.get.remote) }
        [your link]
    {/if}
    

    grep is your friend.

  • Options
    peregrineperegrine MVP
    edited March 2012

    Thanks for the feedback @x00

    This looked promising but:

    
     {if isset($smarty.get.remote) }
      [WPHOME link]
     {/if}
    
    

    I added it to the default.master.tpl in the embed friendly theme.

    When in the embedded wordpress. The first iteration worked I did not see my menu Item WPHOME displayed (exactly what I wanted, however when I clicked discussions from the vanilla menu bar WPHOME showed up, same with activity, etc.

    I tried negating {if !(isset($smarty.get.remote)) } no luck either.

    It looked very promising and very easy. Seems the setting is one way on the first go around within wordpress and then is set the other way the minute a vanilla menu item is clicked.

    I know there is an AddLink
    $Sender->Menu->AddLink

    Is there a RemoveLink or some other way to make the menu item appear conditionally off for the first time viewed in wordpress and each additional time.

    And on when viewed outside of wordpress and then swapped to on when going into wordpress?

    I didn't look at the wordpress frame breakers - I got the drift from you message that this may not be too secure.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Sorry i forgot to negate.

    are you using absolute paths for link? try relative.

    you might try

    {if !isset($smarty.get.t) }
      [WPHOME link]
    {/if}
    

    Also what version of embed you you have? It should just work. Are you you sung the wordpress vanilla plugin to embed?

    I didn't look at the wordpress frame breakers - I got the drift from you message that this may not be too secure.

    no I mean it stops third parties using bits of you site inside frames.

    grep is your friend.

  • Options

    Thanks again for you effort.
    I tried absolute and relative with your permutations - no success.

    e.g.
    http://www.example.com

    I noticed on further testing of a test plugin

    public function Base_Render_Before($Sender) {
          
          $Session = Gdn::Session();
    
        if ($Sender->Menu) {
               $url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
              preg_match('/discussions-2/', $url,$matches) ;
              var_dump($matches);
              print_r($matches);   
              ....
    

    Upon loading Wordpress test on localhost

    http://localhost/wordpress/discussions-2/#/discussions

    $matches would match discussions-2 upon loading and subsequent clicks in the vanilla menu on discussion or activity would not match.

    I guess the iframe effectively removes any concept of the discussions-2

    I'll look at the frame breaker, any particular one you recommend?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    x00x00 MVP
    edited March 2012

    I wonder if you are using old versions of the plugins, it should work. The iframe loader should link to an address with remote in it.

    try WP No Frames

    grep is your friend.

  • Options

    I hadn't installed plugin WP No Frames when I reported the results.

    I installed the plugin you suggested.
    So far, so good. WP No Frames

    Thanks much.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.