Make WordPress Core

Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#20563 closed enhancement (duplicate)

Add actions between sections in User Edit form

Reported by: sc0ttkclark's profile sc0ttkclark 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)

#1 @sc0ttkclark
12 years ago

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.

#2 @scribu
12 years ago

The general solution here would be to use the Settings API on this screen.

#3 @sc0ttkclark
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.

#4 @sc0ttkclark
12 years ago

@scribu - There's ticket #13548 which is a request for the Settings API on this screen, this current ticket could still be separate, or it's needs could be taken into consideration under #13548 buildout.

#6 @chriscct7
9 years ago

  • Owner set to chriscct7
  • Status changed from new to assigned

In

#7 @DrewAPicture
9 years ago

  • Component changed from Plugins to Users
  • Focuses administration added

#8 @chriscct7
9 years ago

  • Keywords needs-patch removed
  • Owner chriscct7 deleted

#9 @chriscct7
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #28754.

#10 @chriscct7
9 years ago

  • Focuses administration removed
Note: See TracTickets for help on using tickets.