Opened 16 years ago
Closed 16 years ago
#9302 closed enhancement (fixed)
Add hook for update profile
Reported by: | Cimmo | Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | Users | Keywords: | profile hook |
Focuses: | Cc: |
Description
As today there is no possibility to add some checks to profile update, this is limiting Cimy User Extra Fields.
I suggest to add this hook, see patch.
Attachments (3)
Change History (21)
#2
@
16 years ago
No that hook is not useful, because the $errors array is not passed and user is updated anyway if there are errors on extra fields.
#4
follow-up:
↓ 5
@
16 years ago
- Keywords reporter-feedback added; profile hook dev-feedback removed
I use the following hooks in my author images plugin:
- edit_user_profile
- show_user_profile
- profile_update
can you confirm they're not enough?
#5
in reply to:
↑ 4
@
16 years ago
- Keywords profile hook dev-feedback added; reporter-feedback removed
Replying to Denis-de-Bernardy:
I use the following hooks in my author images plugin:
- edit_user_profile
- show_user_profile
- profile_update
can you confirm they're not enough?
If you can show me that with those three I can prevent an user to be updated because some extra fields didn't pass some checks/rules then yes, but I doubt you can.
#6
follow-up:
↓ 7
@
16 years ago
- Milestone 2.8 deleted
- Resolution set to invalid
- Status changed from new to closed
you can redirect/die on pre_user_login
#7
in reply to:
↑ 6
@
16 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Replying to Denis-de-Bernardy:
you can redirect/die on pre_user_login
but WordPress crew got a course for people closing bugs? Seems you answer with the silliest answer all the time.
HOW can I add errors to be displayed with your filter?
#9
follow-up:
↓ 10
@
16 years ago
- Resolution set to invalid
- Status changed from reopened to closed
you can pass an error_id argument in the url you redirect to.
plus, there are like... so many other hooks you can hook into. like load-profile.php, load-user-edit.php, load-user-new.php. not to mention personal_options_update and edit_user_profile_update, which occur before the update.
if anything, the real trouble is choosing the one you'd rather use...
#10
in reply to:
↑ 9
;
follow-up:
↓ 12
@
16 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Replying to Denis-de-Bernardy:
you can pass an error_id argument in the url you redirect to.
I do NOT redirect anything, I use the form already present under profile, so can you explain it better?
plus, there are like... so many other hooks you can hook into. like load-profile.php,
is this a file? an hook? can you show me where is that searching for it I didn't find it?
load-user-edit.php, load-user-new.php.
and those? Same as above.
not to mention personal_options_update and edit_user_profile_update, which occur before the update.
yea not to mentioned that I _already_ mentioned that those hooks are useless since $errors array is NOT passed, so profile is updated ANYWAY, regardless my errors.
if anything, the real trouble is choosing the one you'd rather use...
if anything, the real trouble is finding people that read carefully instead of trolling around.
#11
@
16 years ago
Summerizing my patch does:
0) enable extra check on fields
1) enable you to stop updating profile if some extra errors are added by plug-in
2) display _automatically_ those errors at the top of the profile, together with other
NOW:
is there a possibility to do 1+2+3 with actual WordPress? Looking at the code I do not see the possibility, with my 1 line patch that does not hurt anyone, you can do all the three at once.
NOT to mention that a similar hook is present for registration, so there is no point why there and not here.
#12
in reply to:
↑ 10
@
16 years ago
Replying to Cimmo:
plus, there are like... so many other hooks you can hook into. like load-profile.php,
is this a file? an hook? can you show me where is that searching for it I didn't find it?
wp-admin/admin.php
every default admin page has a load-something hook that gets called before the page is actually loaded, and every plugin page gets two: load-something_plugin and something_plugin.
personally, I usually use the first to load files only when needed, and the second to trigger save procedures -- because by then, you know the user is valid so don't need to worry about permissions.
if anything, the real trouble is finding people that read carefully instead of trolling around.
I'd actually take offense on that if you had authored as many WP plugins as I have...
#14
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
I have seen that under wp-login.php "same" hook pass also $user_login and $user_email so I thought we can enhance my original patch before breaking compatibility on a stable release :)
#16
@
16 years ago
- Component changed from Validation to Users
- Milestone set to 2.8
- Version set to 2.8
#17
@
16 years ago
- Keywords dev-feedback removed
Well in PHP5 it will get passed by reference here. But I believe in PHP4 it will not!
So currently this works for PHP5 and not PHP4 I suspect (no PHP4 test setup here at the moment)
So yeah we need to use references here otherwise the hooked function can't change what's in the $errors in all PHP versions.
As for passing in the user_login and user_email I'm not sure why they should be treated as special here. Why not just pass in the currently processed $user object?
Do we need a new action or perhaps
do_action('edit_user_profile_update');
can be used?