WordPress.org

Make WordPress Core

Ticket #26869: admin_post_actions.2.diff

File admin_post_actions.2.diff, 1.3 KB (added by DrewAPicture, 4 years ago)

admin_post_* actions round two.

  • src/wp-admin/admin-post.php

     
    2626/** This action is documented in wp-admin/admin.php */ 
    2727do_action( 'admin_init' ); 
    2828 
    29 $action = 'admin_post'; 
     29$request_action = empty( $_REQUEST['action'] ) ? '' : '_' . $_REQUEST['action']; 
    3030 
    31 if ( !wp_validate_auth_cookie() ) 
    32         $action .= '_nopriv'; 
    33  
    34 if ( !empty($_REQUEST['action']) ) 
    35         $action .= '_' . $_REQUEST['action']; 
    36  
    37 /** 
    38  * Fires the requested handler action. 
    39  * 
    40  * admin_post_nopriv_{$_REQUEST['action']} is called for not-logged-in users. 
    41  * admin_post_{$_REQUEST['action']} is called for logged-in users. 
    42  * 
    43  * @since 2.6.0 
    44  */ 
    45 do_action( $action ); 
     31if ( ! wp_validate_auth_cookie() ) { 
     32        /** 
     33         * Fires the requested handler action for not-logged-in users. 
     34         * 
     35         * The dynamic portion of the hook name, $action, refers to the handler action. 
     36         * 
     37         * @since 2.6.0 
     38         */ 
     39        do_action( "admin_post_nopriv{$request_action}" ); 
     40} else { 
     41        /** 
     42         * Fires the requested handler action for logged-in users. 
     43         * 
     44         * The dynamic portion of the hook name, $action, refers to the handler action. 
     45         * 
     46         * @since 2.6.0 
     47         */ 
     48        do_action( "admin_post{$request_action}" ); 
     49}