#6612 closed defect (bug) (fixed)
xprofile_avatar_uploaded action hook
Reported by: | landwire | Owned by: | imath |
---|---|---|---|
Milestone: | 2.3.4 | Priority: | normal |
Severity: | normal | Version: | 2.3.0 |
Component: | Media | Keywords: | has-patch commit |
Cc: |
Description
Hi there,
I am using the new way to upload attachments/avatars. I really like it!
The xprofile_avatar_uploaded action is fired when a new image is uploaded. I could not find any other information about another hook anywhere, that's why I post this here.
Unfortunately I do not know at that stage if the avatar is actually set, as the user might just decide to abort and not press "Crop Image". Is there an action/filter hook that is fired when the new avatar is actually set (after pressing "Crop Image")? If yes, which one is it, if not, could that be implemented?
Thanks!
Attachments (3)
Change History (12)
#1
@
9 years ago
- Component changed from Component - Attachments to API - Avatars
- Keywords has-patch added
- Milestone changed from Awaiting Review to 2.3.4
- Type changed from enhancement to defect (bug)
- Version changed from 2.3.3 to 2.3.0
#2
@
9 years ago
Looks good, imath!
One thing, should the 'xprofile_avatar_uploaded'
hook in bp-xprofile-screens.php
pass 'crop'
as the parameter?
#3
@
9 years ago
Thanks for your feedback @r-a-y. You're absolutely right. I've added it in 02.patch
#5
@
9 years ago
Thanks r-a-y, i was about to commit it when after some other tests, i've noticed the "changed their avatar" activity was not created when a user is setting his avatar using the wp-admin/extended profile screen.
That's because bp_xprofile_new_avatar_activity()
is using bp_displayed_user_id()
to get the user id and in the wp-admin/extended profile screen the displayed user id is not set.
So i think we should also add a new parameter to "transport" the user id in the xprofile_avatar_uploaded
action.
I've tested 6612.03.patch (Admin/front) and it's fixing the issue, if no objections i will commit it soon.
Hi landwire
Thanks for your feedback :)
I see. This is a bug actually. Today, using the "new way" when a user profile photo has been successfully cropped or set using the camera, the action
xprofile_screen_change_avatar
is fired, which is wrong.Because this action's real role is to inform the change avatar screen is displayed.
In previous UI, the action used to inform the avatar has been successfully cropped was
xprofile_avatar_uploaded
. So i made a confusion in 2.3.0 and put this action too early, once the avatar was successfully uploaded but before it has been cropped.My mistake. Sorry about it. I suggest the attached patch:
xprofile_screen_change_avatar