Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthorized users can't preview the snapshots #108

Closed
vivacomedia opened this issue Jan 12, 2017 · 8 comments

Comments

Projects
None yet
4 participants
@vivacomedia
Copy link

commented Jan 12, 2017

Wrote to you previously on WordPress.org but not sure if you check comments there, so i decided to post here too.
This plugin is very useful for me but unfortunately it works only for admin users, normal-unauthorized ones can’t preview changes through urls like http://example.com/?customize_snapshot_uuid=***hash_here*** while the description page says they should. In my case it just loads the current “Published” Customizer settings from the main theme if I am viewing the snapshot as an unauthorized user. But I can preview Customizer changes fine at the same url when i am logged in as admin. I tried it on default WordPress themes, different versions (4.6.x and 4.7.x), no plugins installed with no avail is there any fix for this?

P.S. forgot to add that i couldn't find any errors anywhere in error.log also

Thanks a lot in advance!

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2017

@vivacomedia are you using WordPress 4.7? There is currently a large PR (#102) to update Snapshots to re-use the infrastructure added in 4.7 for changesets, and also add compat with 4.7 in general. Would you be able to try that feature branch and see if it resolves your issue? Note that the query param becomes customize_changeset_uuid in that case. And actually, this works without the Snapshots plugin installed at all. In that case, the Snapshots plugin then just provides the UI for allowing changes to be explicitly drafted.

@vivacomedia

This comment has been minimized.

Copy link
Author

commented Jan 13, 2017

Hi westonruter, and thanks for a prompt response! Well it is actually my fault.. I am using 4.7 but i have checked other WP versions like 4.5, then 4.6.2 which oddly didn't work for me too for some reason, eventually I got it working by downgrading to 4.6 I also tried all the branches I could find here with 4.7 version however(!) I didn't change the the query param to customize_changeset_uuid like you suggested I was just refreshing my page all the time for different plugin/wp versions like so http://example.com/?customize_snapshot_uuid=***hash_here*** probably this is the issue. Anyway, thanks again for your help and i will check 4.7 + some other branch with the new query string param later and let you know

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2017

@vivacomedia The feature branch for 4.7-compatibility is refactor/intergrate-changeset and can be seen in PR
#102

The customize_changeset_uuid query parameter is what 4.7 uses which has changesets bake dinto core. The customize_snapshot_uuid is what this plugin uses in for prior versions. But actually I thought that the feature branch would rewrite customize_snapshot_uuid to customize_changeset_uuid. @PatelUtkarsh I didn't see that from the PR; should the plugin support customize_snapshot_uuid as an alias for customize_changeset_uuid in 4.7? In other words, do something like this very early:

if ( isset( $_REQUEST['customize_snapshot_uuid'] ) ) {
    $_REQUEST['customize_changeset_uuid'] = $_REQUEST['customize_snapshot_uuid'];
    $_GET['customize_changeset_uuid'] = $_REQUEST['customize_snapshot_uuid'];
    $_POST['customize_changeset_uuid'] = $_REQUEST['customize_snapshot_uuid'];
}
@valendesigns

This comment has been minimized.

Copy link
Member

commented Jan 14, 2017

@westonruter If the isset check is for customize_snapshot_uuid wouldn't you need to then set customize_changeset_uuid and not the other way around? I guess I'm just not following why you would write over $_REQUEST['customize_snapshot_uuid'] with $_REQUEST['customize_changeset_uuid'] when you're checking to see if customize_snapshot_uuid has a value.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2017

@valendesigns you're absolutely right. I got the order wrong in my example. I updated the comment to fix.

@PatelUtkarsh

This comment has been minimized.

Copy link
Collaborator

commented Jan 16, 2017

I haven't added param back compatibility, will add that in #102 Thanks.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 24, 2017

@vivacomedia can you re-try on the refactor/intergrate-changeset branch now with 4.7 please?

@vivacomedia

This comment has been minimized.

Copy link
Author

commented Feb 28, 2017

yes, it does work, thanks a lot!

@westonruter westonruter modified the milestone: 0.6.0 Jul 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.