cms
cms copied to clipboard
[5.x]: Documentation for `EVENT_AFTER_SAVE_USER_PHOTO` is incorrect
What happened?
The documentation for EVENT_AFTER_SAVE_USER_PHOTO is incorrect, on the Events Generator page. Not sure whether this is because the constant's docblock is also wrong.
Ditto for EVENT_BEFORE_SAVE_USER_PHOTO.
Here is what the docs say...
The docblock in Craft's source code says the same thing...
https://github.com/craftcms/cms/blob/0a86c21cccf84b4dbb2e7e93ab47025938a148e5/src/services/Users.php#L173
The problem is, services\UserSavePhotoEvent is not a real event. It should say events\UserPhotoEvent instead.
Here is what it should actually say...
use yii\base\Event;
use craft\services\Users;
use craft\events\UserPhotoEvent; // <-- CORRECT EVENT
Event::on(
Users::class,
Users::EVENT_AFTER_SAVE_USER_PHOTO,
function (UserPhotoEvent $event) {
// ...
}
);
Steps to reproduce
- Attempt to use the
EVENT_AFTER_SAVE_USER_PHOTOevent as demonstrated in the docs.
Expected behavior
Should work as intended.
Actual behavior
services\UserSavePhotoEvent doesn't actually exist.
Craft CMS version
5.8.17
PHP version
n/a
Operating system and version
n/a
Database type and version
n/a
Image driver and version
n/a
Installed plugins and versions
n/a