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

Ensure that widget actions and filters get added for previewing snapshots for unauthenticated users #33

Closed
westonruter opened this issue Jun 6, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@westonruter
Copy link
Contributor

commented Jun 6, 2016

The constructor for WP_Customize_Widgets has this bit of code before it does the add_action() and add_filter() calls:

// Skip useless hooks when the user can't manage widgets anyway.
if ( ! current_user_can( 'edit_theme_options' ) ) {
    return;
}

This will cause a problem for previewing widgets on the frontend for unauthenticated users because these filters/actions aren't getting added: https://github.com/xwp/wordpress-develop/blob/885d38edc8de04c3cf7baced5ef0effc8c5a6bd6/src/wp-includes/class-wp-customize-widgets.php#L101-L120

Snapshots should be adding these filters and actions (as required) if ! has_filter() or ! has_action().

@westonruter

This comment has been minimized.

Copy link
Contributor Author

commented Jun 6, 2016

I haven't actually verified that this is actually an issue, but I can't see how it wouldn't be an issue 😄

@valendesigns

This comment has been minimized.

Copy link
Member

commented Jun 6, 2016

@westonruter Well, it seems the issue is now much bigger than it was. I cannot see any new widgets in the Snapshot, regardless of if I'm authenticated or not. Even if I comment out that return.

@valendesigns

This comment has been minimized.

Copy link
Member

commented Jun 6, 2016

@westonruter It appears to be an issue with the widget value not being set when saving the Snapshot for new widgets. I'm trying to hunt down the root issue, but if you have any suggestions that would be great. Perhaps there was a change in the widgets API that is causing this?

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.