caseproof / members

Members WordPress plugin.
GNU General Public License v2.0
78 stars 35 forks source link

new notifications module of 3.2.x breaks classic editor in some themes #73

Open daverobertson opened 2 years ago

daverobertson commented 2 years ago

Hi,

Since upgrading to 3.2.1 we've observed a "blank" classic editor in some themes example. It happens for users in roles without the "manage options" capability while editing a post type that does not use gutenberg (e.g. WooCommerce products).

It looks like the culprit is several calls to $this->get()['active'] in class-notifications.php, but when get() returns an empty array (ie, when the has_access() is false), an error will result because there is no value for 'active'. The fix is editing the beginning of the get() method, such as:

    if ( ! self::has_access() ) {
      return [
        'active' => false,
      ];
    }

..so the array is initialized with a value for 'active' the other checks are looking for.

Happy to submit a PR!

renventura commented 2 years ago

Hey @daverobertson. Thanks for the report. I don't see any problems with returning the array as you suggest. So I can see this in action, though, can you let me know a theme I can use to reproduce it on my end?

daverobertson commented 2 years ago

It's a custom theme for a client so I cannot share, however it's based upon an earlier iteration of Sage 10. I haven't checked the most recent release, however error reporting in local development tends to be very "on" with this stack. Thanks!