lumenlearning / candela-citation

Citations for Candela
MIT License
5 stars 4 forks source link

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

Open SteelWagstaff opened 3 years ago

SteelWagstaff commented 3 years ago

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

https://user-images.githubusercontent.com/13485451/121606521-263a4e00-ca03-11eb-87a2-6f5f7f8ac36f.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 https://github.com/pressbooks/pressbooks/issues/2149

SteelWagstaff commented 3 years ago

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: https://github.com/lumenlearning/candela-citation/blob/083e08aee1865de935e9f0240ba1707460df3b6d/inc/class-citation.php#L430-L432.