Astra_Admin_Ajax::disable_astra_pro_notices()
Disable pro upgrade notice from all over in Astra.
Description
Source
File: admin/includes/class-astra-admin-ajax.php
public function disable_astra_pro_notices() {
$response_data = array( 'message' => $this->get_error_msg( 'permission' ) );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( $response_data );
}
if ( empty( $_POST ) ) {
$response_data = array( 'message' => $this->get_error_msg( 'invalid' ) );
wp_send_json_error( $response_data );
}
/**
* Nonce verification.
*/
if ( ! check_ajax_referer( 'astra_update_admin_setting', 'security', false ) ) {
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
wp_send_json_error( $response_data );
}
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You don\'t have the access', 'astra' ) );
}
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$migrate = isset( $_POST['status'] ) ? sanitize_key( $_POST['status'] ) : '';
/** @psalm-suppress PossiblyInvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$migrate = ( 'true' === $migrate ) ? true : false;
astra_update_option( 'ast-disable-upgrade-notices', $migrate );
wp_send_json_success();
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.0.0 | Introduced. |