Closed edalzell closed 7 months ago
I can confirm a similar thing happening when you try to run php please stache:clear
or other stache commands, the error is as follows:
Call to undefined method Statamic\Auth\Eloquent\User::initialPath()
at vendor/statamic/cms/src/Stache/Stores/UsersStore.php:39
..as with the original report, I am getting this on a site that I switched over from file-based users to database-based users. Deleting the file-based user's yaml files stops the error from appearing.
This line worked for me:
Deleting the file-based user's yaml files stops the error from appearing
I think the issue may be with the docs on this... on this page it says "In config/statamic/stache.php, comment out the users store."
That means the stache config still has a users
key as it gets it from core... really what you need to do is set directory
in the users key to null
, and then these commands work fine.
I also had this problem when switching from file-based users to database.
The line in the documentation "In config/statamic/stache.php, comment out the users store" was confusing because the stores
array in my config/statamic/stache.php
file is empty.
However, I can confirm that deleting any remaining yaml files for each user does stop the Call to undefined method Statamic\Auth\Eloquent\User::initialPath()
error from happening.
Adding this method to User model solves issue for me:
public function isSuper()
{
return $this->super;
}
Bug description
I switch users over to the DB, then when you try to access the CP (I think) you get this error: https://github.com/statamic/cms/issues/719#issuecomment-943075400.
Removing the users (and no other changes) makes everything work.
How to reproduce
Logs
No response
Versions
Statamic 3.2.16 Pro Laravel 8.64.0 PHP 8.0.11 aryehraber/statamic-captcha 1.5.2 aryehraber/statamic-uuid 2.0.3 doublethreedigital/duplicator 2.0.0 edalzell/forma 1.0 jonassiewertsen/statamic-livewire 2.7.0 statamic/seo-pro 2.3.2 transformstudios/blackbaud dev-main transformstudios/events 2.2.2 transformstudios/front 1.7.1 transformstudios/gated dev-main transformstudios/magic-link dev-main transformstudios/review 3.1 transformstudios/simple dev-main transformstudios/stripe dev-main transformstudios/takeover-redirects dev-main
Installation
Fresh statamic/statamic site via CLI
Additional details
No response