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

Not loading in recent versions of Craft 3.7.x #51

Closed
daltonrooney opened this issue Jul 13, 2022 · 5 comments
Closed

Not loading in recent versions of Craft 3.7.x #51

daltonrooney opened this issue Jul 13, 2022 · 5 comments

Comments

@daltonrooney
Copy link

I'm not sure exactly when this started, but it appears that MatrixMate assets aren't loading in the CP in recent versions of 3.7. Possibly related? craftcms/cms#11033 (comment)

Craft::$app->getUser()->checkPermission('accessCp') always returns false in the onAfterLoadPlugins() method. Changing the event that loads that method to Application::EVENT_INIT does seem to solve the problem.

@mmikkel
Copy link
Member

mmikkel commented Jul 13, 2022

I'm not able to reproduce that, so it's likely due to a conflict with some other plugin (or a custom module) installed on your end.

You're probably right that this is the same issue as craftcms/cms#2473 (and the one you linked, which is basically the same problem – i.e. craftcms/cms#11033).

I just cut a release 1.4.5 that changes the event MatrixMate listens to from Plugins::EVENT_AFTER_LOAD_PLUGINS to Application::EVENT_INIT – just because that seems to be the official best practice since craftcms/cms@50f6d35 (and also because MatrixMate 2, for Craft 4, is already using that event, so – consistency :)

FYI though, both of these events should actually be safe to use in terms of avoiding the actual problem described in the issues linked. From a core perspective, the EVENT_INIT event is literally triggered right after the PLUGINS_LOADED event – so if this actually solves your issue, this is most likely coincidental, i.e. you most likely have something in your stack that triggers a user element query outside of bounds. Upgrading your site to Craft 4 will likely expose that something, since Craft 4 will log a warning for it.

@daltonrooney
Copy link
Author

Thanks for the detailed background info and pushing a fix so quickly! We’ll be moving this site to Craft 4.1 before the end of the summer but we did deactivate all plugins as part of our testing process before I submitted this so that’s still a mystery.

@mmikkel
Copy link
Member

mmikkel commented Jul 14, 2022

@daltonrooney What about custom modules?

@daltonrooney
Copy link
Author

@mmikkel Yep, just found it, a call to Craft::$app->getUser()->getIdentity(); in a custom module's init() method. Thanks for the tip! 🙌🏻

@mmikkel
Copy link
Member

mmikkel commented Jul 14, 2022

@daltonrooney Right on, thanks for the follow-up!

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

No branches or pull requests

2 participants