Skip to content
Snippets Groups Projects
Commit 0c04890c authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

bugfix(ajax): permission check

parent 13f847f8
No related branches found
No related tags found
1 merge request!28bugfix(ajax): permission check
Pipeline #337473 passed with warnings
......@@ -78,8 +78,8 @@ class AjaxHandler implements HookablePluginDependant {
if ( isset( $_POST[ self::POST_FIELD_NOTICE_NAME ] ) ) {
$noticeName = sanitize_text_field( $_POST[ self::POST_FIELD_NOTICE_NAME ] );
$option_name = PermanentDismissibleNotice::OPTION_NAME_PREFIX . $noticeName;
check_ajax_referer( $option_name, self::POST_FIELD_SECURITY );
$optionName = PermanentDismissibleNotice::OPTION_NAME_PREFIX . $noticeName;
check_ajax_referer( $optionName, self::POST_FIELD_SECURITY );
if ( ! current_user_can( 'edit_posts' ) ) {
wp_send_json_error();
......@@ -91,10 +91,8 @@ class AjaxHandler implements HookablePluginDependant {
$source = null;
}
$option_name = PermanentDismissibleNotice::OPTION_NAME_PREFIX . $noticeName;
update_option(
$option_name,
$optionName,
PermanentDismissibleNotice::OPTION_VALUE_DISMISSED
);
do_action( 'wpdesk_notice_dismissed_notice', $noticeName, $source );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment