[wp-hackers] user edit action equiv for 'personal_options_update'

chris at giantrobot.co.nz chris at giantrobot.co.nz
Sat Sep 16 06:59:49 GMT 2006


Here's a tiny patch (to WP2.0) that adds an action 'user_options_update',
equivalent to 'personal_options_update'. It's called when administrator edits
user details, useful for storing metadata in extra forms added via
show_user_profile and edit_user_profile. Can't see an equivalent in 2.1 (yet).

 * Is 'user_options_update' a good name?
 * Should I just be recycling 'personal_options_update'?

(As the method for getting the user_id to update differs, a different action may
be indicated).

Index: wp-admin/user-edit.php
===================================================================
--- wp-admin/user-edit.php
+++ wp-admin/user-edit.php
@@ -36,10 +36,12 @@

 $errors = array();

-if (!current_user_can('edit_users'))
+if (!current_user_can('edit_users')) {
        $errors['head'] = __('You do not have permission to edit this user.');
-else
+} else {
        $errors = edit_user($user_id);
+       do_action('user_options_update');
+}

 if(count($errors) == 0) {
        header("Location: user-edit.php?user_id=$user_id&updated=true");




More information about the wp-hackers mailing list