WordPress.org

Make WordPress Core

Ticket #18709: 18709.3.patch

File 18709.3.patch, 3.4 KB (added by DrewAPicture, 4 years ago)

hooks + passed context + hook docs

  • src/wp-admin/network/user-new.php

     
    8686        </div> 
    8787<?php } ?> 
    8888        <form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" id="adduser" method="post"> 
     89        <?php 
     90        //duplicate_hook 
     91        do_action( 'user_new_form_before', 'add-new-user' ); ?> 
    8992        <table class="form-table"> 
    9093                <tr class="form-field form-required"> 
    9194                        <th scope="row"><?php _e( 'Username' ) ?></th> 
     
    99102                        <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td> 
    100103                </tr> 
    101104        </table> 
     105        <?php 
     106        //duplicate_hook 
     107        do_action( 'user_new_form_after', 'add-new-user' ); 
     108        ?> 
    102109        <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> 
    103110        <?php submit_button( __('Add User'), 'primary', 'add-user' ); ?> 
    104111        </form> 
  • src/wp-admin/user-new.php

     
    290290<form action="" method="post" name="adduser" id="adduser" class="validate"<?php do_action('user_new_form_tag');?>> 
    291291<input name="action" type="hidden" value="adduser" /> 
    292292<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> 
    293  
     293<?php 
     294/** 
     295 * Fires before the new user form. 
     296 * 
     297 * Passes a contextual string to make both types of new user forms 
     298 * uniquely targetable. Contexts are 'add-existing-user' (Multisite), 
     299 * and 'add-new-user'. 
     300 * 
     301 * @since 3.7.0 
     302 * 
     303 * @param string A contextual string specifying which type of new user form the hook preceeds. 
     304 */ 
     305do_action( 'user_new_form_before', 'add-existing-user' ); 
     306?> 
    294307<table class="form-table"> 
    295308        <tr class="form-field form-required"> 
    296309                <th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th> 
     
    310323        </tr> 
    311324<?php } ?> 
    312325</table> 
     326<?php 
     327/** 
     328 * Fires after the new user form. 
     329 * 
     330 * Passes a contextual string to make both types of new user forms 
     331 * uniquely targetable. Contexts are 'add-existing-user' (Multisite), 
     332 * and 'add-new-user'. 
     333 * 
     334 * @since 3.7.0 
     335 * 
     336 * @param string A contextual string specifying which type of new user form the hook follows. 
     337 */ 
     338do_action( 'user_new_form_after', 'add-existing-user' ); 
     339?> 
    313340<?php submit_button( __( 'Add Existing User '), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?> 
    314341</form> 
    315342<?php 
     
    325352?> 
    326353<form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action('user_new_form_tag');?>> 
    327354<input name="action" type="hidden" value="createuser" /> 
    328 <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ) ?> 
     355<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?> 
    329356<?php 
     357//duplicate_hook 
     358do_action( 'user_new_form_before', 'add-new-user' ); 
     359 
    330360// Load up the passed data, else set to a default. 
    331361foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', 
    332362                                'email' => 'email', 'url' => 'uri', 'role' => 'role', 'send_password' => 'send_password', 'noconfirmation' => 'ignore_pass' ) as $post_field => $var ) { 
     
    412442        <?php } ?> 
    413443</table> 
    414444 
     445<?php 
     446//duplicate_hook 
     447do_action( 'user_new_form_after', 'add-new-user' ); 
     448?> 
     449 
    415450<?php submit_button( __( 'Add New User '), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?> 
    416451 
    417452</form>