wip nonce works now
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<form method="POST" action="<?php echo admin_url( 'admin-post.php' ); ?>">
|
|
||||||
<?php wp_nonce_field($nonce['_action'], $nonce['_name']); ?>
|
|
||||||
<!-- https://developer.wordpress.org/reference/hooks/admin_post_action/ -->
|
<!-- https://developer.wordpress.org/reference/hooks/admin_post_action/ -->
|
||||||
|
<form method="POST" action="<?php echo admin_url( 'admin-post.php' ); ?>">
|
||||||
<input type="hidden" name="action" value="add_patches">
|
<input type="hidden" name="action" value="add_patches">
|
||||||
|
<?php wp_nonce_field($nonce['_action'], $nonce['_name']); ?>
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="calculation_patch" name="calculation" checked />
|
<input type="checkbox" id="calculation_patch" name="calculation" checked />
|
||||||
<label for="calculation_patch">calculation patch</label>
|
<label for="calculation_patch">calculation patch</label>
|
||||||
|
|||||||
@@ -29,20 +29,17 @@ function plugin_content() {
|
|||||||
|
|
||||||
|
|
||||||
function choose_patches() {
|
function choose_patches() {
|
||||||
error_log("_POST: " . json_encode($_POST));
|
|
||||||
$nonce = Fbpatch::NONCE;
|
$nonce = Fbpatch::NONCE;
|
||||||
if (!isset($_POST[$nonce['_name']])) {
|
if (!isset($_POST[$nonce['_name']])) {
|
||||||
error_log("_POST[{$nonce['_name']}] is not set");
|
|
||||||
\FBPATCH\redirect_menu($_POST);
|
\FBPATCH\redirect_menu($_POST);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!wp_verify_nonce($nonce['_name'], $nonce['_action'])) {
|
if (!wp_verify_nonce($_POST[$nonce['_name']], $nonce['_action'])) {
|
||||||
error_log("is logged in: " . json_encode(is_user_logged_in()));
|
|
||||||
error_log("verify nonce false");
|
|
||||||
\FBPATCH\redirect_menu($_POST);
|
\FBPATCH\redirect_menu($_POST);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error_log("is logged in: " . json_encode(is_user_logged_in()));
|
error_log("is logged in: " . json_encode(is_user_logged_in()));
|
||||||
|
\FBPATCH\redirect_menu($_POST);
|
||||||
}
|
}
|
||||||
add_action('admin_post_add_patches', __NAMESPACE__.'\choose_patches');
|
add_action('admin_post_add_patches', __NAMESPACE__.'\choose_patches');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user