mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-14 04:06:36 +09:00
Add nonce in registration form
This commit is contained in:
@@ -2,4 +2,24 @@
|
||||
|
||||
class UM_Register {
|
||||
|
||||
function __construct(){
|
||||
|
||||
add_action("um_after_register_fields", array( $this, 'add_nonce' ) );
|
||||
add_action("um_submit_form_register", array( $this, 'verify_nonce'), 1, 1);
|
||||
}
|
||||
|
||||
public function add_nonce(){
|
||||
wp_nonce_field( 'um_register_form' );
|
||||
}
|
||||
|
||||
public function verify_nonce( $args ){
|
||||
global $ultimatemember;
|
||||
|
||||
if ( ! wp_verify_nonce( $args['_wpnonce'], 'um_register_form' ) || empty( $args['_wpnonce'] ) || ! isset( $args['_wpnonce'] ) ) {
|
||||
wp_die('Invalid Nonce.');
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user