Skip to content

[5.x]: Documentation for EVENT_AFTER_SAVE_USER_PHOTO is incorrect #18030

@lindseydiloreto

Description

@lindseydiloreto

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...

Users::EVENT_AFTER_SAVE_USER_PHOTO

The docblock in Craft's source code says the same thing...

* @event UserSavePhotoEvent The event that is triggered before a user photo is saved.

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

  1. Attempt to use the EVENT_AFTER_SAVE_USER_PHOTO event 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions