[wp-trac] [WordPress Trac] #20563: Add actions between sections in User Edit form

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 27 22:20:08 UTC 2012


#20563: Add actions between sections in User Edit form
-------------------------+-----------------------------
 Reporter:  sc0ttkclark  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Plugins      |    Version:  3.4
 Severity:  normal       |   Keywords:  needs-patch
-------------------------+-----------------------------
 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();
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20563>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list