Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Undefined property notice when saving Custom CSS when this plugin is active in Pressbooks #12

Open
SteelWagstaff opened this issue Jun 10, 2021 · 1 comment

Comments

@SteelWagstaff
Copy link
Contributor

Description
On the Pressbooks network with WP_DEBUG set to true, we see an Undefined property: stdClass::$edit_page in /srv/www/integrations.pressbooks.network/releases/20210427183011/web/wp-includes/capabilities.php on line 172 notice whenever we save Custom CSS if this plugin is active.

Steps to Reproduce

  1. Open a book on a Pressbooks network with WP_DEBUG set to true and the Candela Citations plugin active and click Appearance -> Custom Styles
  2. Save a change to the CSS
  3. Observe a white screen briefly displaying the notice indicated above before you're returned to the Pressbooks interface
candela_permission_error.mp4

Expected behavior:
No notice is displayed

Actual behavior:
A notice is diplayed.

Notes
Here's the line cited by the notice: https://github.com/WordPress/WordPress/blob/267061c9595fedd321582d14c21ec9e7da2dcf62/wp-includes/capabilities.php#L172

Like #7, this issue is only present when Candela Citations is activated, and disappears when that plugin is deactivated.

More details at pressbooks/pressbooks#2149

@SteelWagstaff
Copy link
Contributor Author

I don't know how this plugin works very well yet, but did notice that the plugin contains a 'save' function which attempts to check whether current_user_can permissions allow them to edit_page for a specific post_id:

if ( ! current_user_can( 'edit_page', $post_id ) ) {
return $post_id;
}
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant