Open andwebro opened 1 year ago
Some sort of fix & simplify:
...
// for existing users, email address since we know we'll always have that
// Use default hash if new user or the avatar is used as a placeholder
$idString = 'default-avatar-hash'; // Default avatar string
if ($this->id) {
if (setting('Users.avatarNameBasis') === 'name') {
$idString = $this->first_name ? $this->first_name[0] . ($this->last_name[0] ?? '') : $this->username[0] . $this->username[1];
} else {
$idString = $this->email[0] . $this->email[1];
}
}
$idString = strtoupper($idString);
...
This error is still being thrown if in DB settings table the useGravatar key is set to value 1 (that is, if you check "Use Gravatar for avatars" option in the Users settings):
Here is how it is logged:
WARNING - 2023-04-22 12:40:36 --> [DEPRECATED] Implicit conversion from float-string "68697065857684456586658465824572658372" to int loses precision in VENDORPATH/lonnieezell/bonfire/src/Users/User.php on line 48.
1 VENDORPATH/lonnieezell/bonfire/src/Users/Views/form.php(39): Bonfire\Users\User->renderAvatar(140)
2 SYSTEMPATH/View/View.php(213): include('/home/dg/Programavimas/MOK/bonfire2/vendor/lonnieezell/bonfire/src/Users/Views/form.php')
3 SYSTEMPATH/View/View.php(216): CodeIgniter\View\View->CodeIgniter\View\{closure}()
4 VENDORPATH/lonnieezell/bonfire/src/View/Themeable.php(46): CodeIgniter\View\View->render('Bonfire\\Users\\Views\\form', null, true)
5 VENDORPATH/lonnieezell/bonfire/src/Users/Controllers/UserController.php(74): Bonfire\Core\BaseController->render('Bonfire\\Users\\Views\\form', [...])
6 SYSTEMPATH/CodeIgniter.php(934): Bonfire\Users\Controllers\UserController->create()
7 SYSTEMPATH/CodeIgniter.php(499): CodeIgniter\CodeIgniter->runController(Object(Bonfire\Users\Controllers\UserController))
8 SYSTEMPATH/CodeIgniter.php(368): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
9 FCPATH/index.php(67): CodeIgniter\CodeIgniter->run()
10 SYSTEMPATH/Commands/Server/rewrite.php(47): require_once('/home/dg/Programavimas/MOK/bonfire2/public/index.php')
CRITICAL - 2023-04-22 12:40:36 --> "$user->id" is null. You should not use the incomplete User object.
in VENDORPATH/codeigniter4/shield/src/Models/UserIdentityModel.php on line 85.
1 VENDORPATH/codeigniter4/shield/src/Models/UserIdentityModel.php(235): CodeIgniter\Shield\Models\UserIdentityModel->checkUserId()
2 VENDORPATH/codeigniter4/shield/src/Entities/User.php(89): CodeIgniter\Shield\Models\UserIdentityModel->getIdentities()
3 VENDORPATH/codeigniter4/shield/src/Entities/User.php(103): CodeIgniter\Shield\Entities\User->populateIdentities()
4 VENDORPATH/codeigniter4/shield/src/Entities/User.php(74): CodeIgniter\Shield\Entities\User->getIdentities()
5 VENDORPATH/codeigniter4/shield/src/Entities/User.php(142): CodeIgniter\Shield\Entities\User->getIdentity()
6 VENDORPATH/codeigniter4/shield/src/Entities/User.php(222): CodeIgniter\Shield\Entities\User->getEmailIdentity()
7 SYSTEMPATH/Entity/Entity.php(493): CodeIgniter\Shield\Entities\User->getEmail()
8 VENDORPATH/lonnieezell/bonfire/src/Users/User.php(60): CodeIgniter\Entity\Entity->__get()
9 VENDORPATH/lonnieezell/bonfire/src/Views/_avatar.php(4): Bonfire\Users\User->avatarLink()
10 SYSTEMPATH/View/View.php(213): include('/home/dg/Programavimas/MOK/bonfire2/vendor/lonnieezell/bonfire/src/Views/_avatar.php')
11 SYSTEMPATH/View/View.php(216): CodeIgniter\View\View->CodeIgniter\View\{closure}()
12 SYSTEMPATH/Common.php(1184): CodeIgniter\View\View->render()
13 VENDORPATH/lonnieezell/bonfire/src/Users/User.php(48): view()
14 VENDORPATH/lonnieezell/bonfire/src/Users/Views/form.php(39): Bonfire\Users\User->renderAvatar()
15 SYSTEMPATH/View/View.php(213): include('/home/dg/Programavimas/MOK/bonfire2/vendor/lonnieezell/bonfire/src/Users/Views/form.php')
16 SYSTEMPATH/View/View.php(216): CodeIgniter\View\View->CodeIgniter\View\{closure}()
17 VENDORPATH/lonnieezell/bonfire/src/View/Themeable.php(46): CodeIgniter\View\View->render()
18 VENDORPATH/lonnieezell/bonfire/src/Users/Controllers/UserController.php(74): Bonfire\Core\BaseController->render()
19 SYSTEMPATH/CodeIgniter.php(934): Bonfire\Users\Controllers\UserController->create()
20 SYSTEMPATH/CodeIgniter.php(499): CodeIgniter\CodeIgniter->runController()
21 SYSTEMPATH/CodeIgniter.php(368): CodeIgniter\CodeIgniter->handleRequest()
22 FCPATH/index.php(67): CodeIgniter\CodeIgniter->run()
23 SYSTEMPATH/Commands/Server/rewrite.php(47): require_once('/home/dg/Programavimas/MOK/bonfire2/public/index.php')
I think it is safe to assume this has been fixed.
Hello,
I am playing around with the admin panel of Bonfire2 and seems new users can't be added from the admin panel. So, the route is: admin/users/new And the following error is thrown: "$user->id" is null. You should not use the incomplete User object by the model VENDORPATH\codeigniter4\shield\src\Models\UserIdentityModel.php at line 81
Obviously the error is thrown by Shield but I think it all starts in a call from the following VENDORPATH\lonnieezell\bonfire\src\Users\User.php : 26![image](https://user-images.githubusercontent.com/33346462/212703659-867a3288-22b3-4379-b794-0461ee3f363e.png)
Thanks