• tenserd

    (@tenserd)


    Hi again,

    when I setup the mapping and change something on the site and want to watch it in preview mode it loads the page with the given URL.

    Is it possible to manage this by hand or can you provide this in an future update, that clicking on preview it will loads the main-URL/pagename&preview=true with the preview on it?

    Cheers
    Dennis

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author matthias.wagner

    (@matthiaswagner)

    hy,
    i can’t figure out what is wrong if preview is done with the mapped domain? or is preview not working at all with mappings?

    Thread Starter tenserd

    (@tenserd)

    U answer as fast as lightspeed : )

    I don’t know what the problem was, now it works but:

    I have setup one domain with and one without ssl. The one with ssl works fine but the one without will get an https// instead of just http// in front of the URL and can’t get open up because of security block on the browser. When I accept an exception it redirects me to the server-standard page for domains which have no routing.

    Can I send you the link on your email which is posted on your page?

    Thread Starter tenserd

    (@tenserd)

    Sorry … back to it

    It also don’t work with https mapped domains. It shows:

    “Du bist leider nicht berechtigt, Entwürfe anzusehen.”

    For all others (don’t have the original english line):
    Unfortunately, you are not allowed to view designs.

    Plugin Author matthias.wagner

    (@matthiaswagner)

    hy,

    ah ok – yes the problem is that the cookie with the information that you are logged in is set only for the main domain. we have not yet built the possibility to stay logged in across all domains. this is something already on our roadmap but we won’t have time for it in the next few months :/
    if you are familiar with php you could find the part in the plugin where domains are changed and add a conditional statement – if url contains “preview=true” do not make anything. this is something we will discuss for future releases.

    thanks for finding this out
    matt

    Thread Starter tenserd

    (@tenserd)

    g’morning,

    OK, I found the line inside the file “+ Change/Add Cookies to be logged in on other domains?”

    I hope to find someone which has the time to look into the code. Otherwise I’ll wait untill its in one of the next updates.

    Cheers and a relaxed rest of the week,
    Dennis

    Plugin Author matthias.wagner

    (@matthiaswagner)

    this is just the roadmap part in the file ??

    Moogie17

    (@moogie17)

    @tenserd I don’t suppose you worked out the fix for the preview button at all did you? I’m having the same problem. It would be great if you’d be willing to share the fix if you have it! ?? Thanks for your time.

    Thread Starter tenserd

    (@tenserd)

    Hi Moogie17,

    sry, didn’t found an wordpress dev. to manage this atm.

    When I find someone who can manage this, I’ll give a ping here : )

    Cheers,
    Dennis

    Moogie17

    (@moogie17)

    Thanks very much Dennis, that’s really kind. Meanwhile should I manage to solve it myself I will of course let you know ??

    Moogie17

    (@moogie17)

    @tenserd

    I haven’t tested it extensively yet but after a lot of reading around and trial and error this morning I’ve come up with a fix which seems to work, at least for my case.

    The following placed in the functions.php file of your theme (or added as a plugin I guess) may help you:

    // Fix post preview button link to work with  Multiple Domain Mapping on Single Site Plugin
    
    function moogiet_fix_preview_link() {
    
    	$moogiet_path = get_page_uri();
    
    	$moogiet_baseurl = home_url();
    	
    $moogiet_newurl = "$moogiet_baseurl/$moogiet_path/?preview=true";
    
    	return $moogiet_newurl;
    
    	}
    
    add_filter( 'preview_post_link', 'moogiet_fix_preview_link',30 );

    This replaces the preview link with a re-generated link comprising the site’s home url, the path of the current post/page and appending the ?preview=true query string. So far it seems to be working OK for me, but will let you know if I find any issues with it!

    • This reply was modified 7 years ago by Moogie17.
    Plugin Author matthias.wagner

    (@matthiaswagner)

    looks like a good filter to do that job!
    i started to implement it too, but i want to publish it with a lot of refactoring in the other code. but as usual there is no time for that ??

    matt

    Thread Starter tenserd

    (@tenserd)

    Hey Moogie17,

    thx for the work. I tried it but its caos now. I tried it in 3 different browsers and will have 2 different behaviours.

    I have this structure:
    top-level-page/sub-page1/current-page <- this is where the mapping is pointing to
    top-level-page/sub-page2/current-page <- this is the shop-page with another sub but same page-name

    When I will preview “/sub-page1/current-page”:

    On one browser it will show:
    top-level-page/wp-login?redirect_to=top-level-page/wp-admin/post.php&reauth=1

    On the other 2 browsers it shows:
    top-level-page/sub-page2/current-page

    When I change the page-name of sub-page2 the preview will direct to this constalation:
    top-level-page/current-page/?preview=true <- the sub-page is missing

    I hope this is understandable : )

    All the best,
    Dennis

    • This reply was modified 7 years ago by tenserd.
    Plugin Author matthias.wagner

    (@matthiaswagner)

    hy @tenserd,

    if you experience different results in different browsers it is most likely that it is because of redirections saved in browser cache or a different login-status.

    Thread Starter tenserd

    (@tenserd)

    Hi,

    nope, exacly on this situation I tried different browsers I never used with this page. After your post I cleaned up everything and its the same strange behaviour.

    But its ok. I finish up the layout for the special Domain-Landing elsewhere in the system and just give text and images free to change. The pages have to be saved and not previewed – I disable the button for co-workers.

    Cheers,
    Dennis

    Moogie17

    (@moogie17)

    @tenserd Sorry it didn’t work for you. As it turns out my poor tired brain totally failed with that code, as obviously it doesn’t add the preview nonce or preview ID so the link isn’t actually the page preview. I don’t know why you were having the URL discrepancies but I’m going to have to go back to the drawing board on this haha.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Previewpage loads with new URL’ is closed to new replies.