| 1 |
<?php |
| 2 |
/** |
| 3 |
* This file contain code to handle email notification setting ajax. |
| 4 |
* |
| 5 |
* Register settings Include and setup custom metaboxes and fields. |
| 6 |
* |
| 7 |
* @package Give |
| 8 |
* @subpackage Classes/Emails |
| 9 |
* @license https://opensource.org/licenses/gpl-license GNU Public License |
| 10 |
* @link https://github.com/webdevstudios/Custom-Metaboxes-and-Fields-for-WordPress |
| 11 |
*/ |
| 12 |
|
| 13 |
/** |
| 14 |
* Enabled & disable notification |
| 15 |
* |
| 16 |
* @since 2.0 |
| 17 |
*/ |
| 18 |
function give_set_notification_status_handler() { |
| 19 |
// Is user have permission to edit give setting. |
| 20 |
if ( ! current_user_can( 'manage_give_settings' ) ) { |
| 21 |
return; |
| 22 |
} |
| 23 |
|
| 24 |
$notification_id = isset( $_POST['notification_id'] ) ? give_clean( $_POST['notification_id'] ) : ''; |
| 25 |
if ( ! empty( $notification_id ) && give_update_option( "{$notification_id}_notification", give_clean( $_POST['status'] ) ) ) { |
| 26 |
wp_send_json_success(); |
| 27 |
} |
| 28 |
|
| 29 |
wp_send_json_error(); |
| 30 |
} |
| 31 |
|
| 32 |
add_action( 'wp_ajax_give_set_notification_status', 'give_set_notification_status_handler' ); |
| 33 |
|