Astra_Addon_Admin_Ajax::enable_disable_beta_updates()
Ajax handler to enable / disable the beta updates for Astra Theme and Astra Pro.
Description
Return
(void)
Source
File: admin/core/includes/class-astra-addon-admin-ajax.php
public function enable_disable_beta_updates() {
$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_addon_update_admin_setting', 'security', false ) ) {
$response_data = array( 'message' => $this->get_error_msg( 'nonce' ) );
wp_send_json_error( $response_data );
}
$status = isset( $_POST['status'] ) ? sanitize_text_field( $_POST['status'] ) : false;
if ( false !== $status ) {
Astra_Admin_Helper::update_admin_settings_option( '_astra_beta_updates', $status, true );
wp_send_json_success();
}
wp_send_json_error();
}
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.5.1 | Introduced. |