Add a `user_new_form` hook, with context. props johnjamesjacoby, strangerstudios, jeremyfelt, DrewAPicture. fixes #18709.

Built from https://develop.svn.wordpress.org/trunk@25629


git-svn-id: http://core.svn.wordpress.org/trunk@25546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2013-09-26 01:48:10 +00:00
parent 82904baffd
commit 6cee949cab
2 changed files with 24 additions and 1 deletions

View File

@ -99,6 +99,10 @@ if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?>
<td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
</tr>
</table>
<?php
//duplicate_hook
do_action( 'user_new_form', 'add-new-user' );
?>
<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
<?php submit_button( __('Add User'), 'primary', 'add-user' ); ?>
</form>

View File

@ -310,6 +310,20 @@ if ( is_multisite() ) {
</tr>
<?php } ?>
</table>
<?php
/**
* Fires at the end of the new user form.
*
* Passes a contextual string to make both types of new user forms
* uniquely targetable. Contexts are 'add-existing-user' (Multisite),
* and 'add-new-user' (single site and network admin).
*
* @since 3.7.0
*
* @param string A contextual string specifying which type of new user form the hook follows.
*/
do_action( 'user_new_form', 'add-existing-user' );
?>
<?php submit_button( __( 'Add Existing User '), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
</form>
<?php
@ -325,7 +339,7 @@ if ( current_user_can( 'create_users') ) {
?>
<form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action('user_new_form_tag');?>>
<input name="action" type="hidden" value="createuser" />
<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ) ?>
<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
<?php
// Load up the passed data, else set to a default.
foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
@ -412,6 +426,11 @@ if ( apply_filters( 'show_password_fields', true ) ) : ?>
<?php } ?>
</table>
<?php
//duplicate_hook
do_action( 'user_new_form', 'add-new-user' );
?>
<?php submit_button( __( 'Add New User '), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
</form>