| @@ -84,8 +84,9 @@ | ||
| 84 | 84 | 'woocommerce' => EmailLists::woocommerce_email(), |
| 85 | 85 | 'wordpress' => EmailLists::wordpress_email(), |
| 86 | 86 | 'saved-templates' => EmailLists::saved_templates(), |
| 87 | 87 | 'metform' => EmailLists::metform_email(), |
| 88 | + 'popupkit' => EmailLists::popupkit_email(), | |
| 88 | 89 | ]; |
| 89 | 90 | |
| 90 | 91 | return $type_list[ $type ] ?? []; |
| 91 | 92 | } |
| @@ -151,8 +152,15 @@ | ||
| 151 | 152 | function update_template_data( ) { |
| 152 | 153 | // verify request |
| 153 | 154 | if( empty( $_POST[ 'nonce' ] ) || !wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ 'nonce' ] ) ), 'emailkit_nonce' ) ) { |
| 154 | 155 | return false; |
| 156 | + } | |
| 157 | + | |
| 158 | + // check user capability | |
| 159 | + if( ! current_user_can('manage_options') ) { | |
| 160 | + | |
| 161 | + wp_send_json_error( esc_html__( 'Insufficient permissions', 'emailkit' ), 403 ); | |
| 162 | + exit; | |
| 155 | 163 | } |
| 156 | 164 | |
| 157 | 165 | $ID = isset( $_POST[ 'id' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'id' ] ) ) : null; |
| 158 | 166 | $new_title = isset( $_POST[ 'title' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'title' ] ) ) : ''; |