#20563 closed enhancement (duplicate)
Add actions between sections in User Edit form
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4 |
Component: | Users | Keywords: | |
Focuses: | Cc: |
Description
Currently there is only one hookable area in the User Edit to cleanly output additional fields: 'edit_user_profile' / 'show_user_profile'
I suggest we add another set just before each of the H3 tags on this page (/wp-admin/user-edit.php).
Above Personal Options:
<?php if ( IS_PROFILE_PAGE ) do_action( 'show_user_profile_personal', $profileuser ); else do_action( 'edit_user_profile_personal', $profileuser ); ?> <h3><?php _e('Personal Options'); ?></h3>
Above Name:
<?php if ( IS_PROFILE_PAGE ) do_action( 'show_user_profile_name', $profileuser ); else do_action( 'edit_user_profile_name', $profileuser ); ?> <h3><?php _e('Name') ?></h3>
Above Contact Info:
<?php if ( IS_PROFILE_PAGE ) do_action( 'show_user_profile_contact', $profileuser ); else do_action( 'edit_user_profile_contact', $profileuser ); ?> <h3><?php _e('Contact Info') ?></h3>
Above About:
<?php if ( IS_PROFILE_PAGE ) do_action( 'show_user_profile_about', $profileuser ); else do_action( 'edit_user_profile_about', $profileuser ); ?> <h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3>
For hooking into the save, I believe the existing action 'user_profile_update_errors' will suffice, though I'm not sure if that's the best name for having developers hook into for adding their own field and this runs after error checking.. So we could also add an action before error checking runs to allow for more extensibility to modify existing fields being saved there (letting you still use WP built-in error handling).
This would be added around line 130 in /wp-admin/includes/user.php:
// Allow plugins to modify user fields before error handling do_action_ref_array( 'user_profile_update', array ( &$user, $update ) ); $errors = new WP_Error();
Change History (10)
#3
@
12 years ago
@scribu - I entirely agree here, as long as also there remains some action that runs below each section, so that plugins can add their own sections within the page.
Also, I'm aware personal options has it's own hook, but it's only for within the table or after the table specifically only on the profile (self) page.