[wp-hackers] How to use the edit_user_profile action?

David Coppit david at coppit.org
Sun Jan 15 21:12:56 GMT 2006


Hello all,

I'm writing a plugin that has user-specific configuration. Using the
"edit_user_profile" action I can append a form to the bottom of the edit
user page.

However, the code short-circuits the update action, so that my plugin
never has a chance to update its user config. That is,
wp-admin/user-edit.php says:

 	case 'update':

 	$errors = array();

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

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

How am I supposed to update my options? Do we need a new action? i.e.:

 	case 'update':

 	$errors = array();

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

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

David

_____________________________________________________________________
David Coppit                           david at coppit.org
The College of William and Mary        http://coppit.org/

"If we knew what it was we were doing, it would not be called research,
would it?" -- Albert Einstein


More information about the wp-hackers mailing list