?> <div id="give-payment-notes" class="postbox"> <h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?> </span></h3> <div class="inside"> <div id="give-payment-notes-inner"> <?php $notes = give_get_payment_notes($payment_id); if (!empty($notes)) { $no_notes_display = ' style="display:none;"'; foreach ($notes as $note) { echo give_get_payment_note_html($note, $payment_id); } } else { $no_notes_display = ''; } echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __('No payment notes', 'give') . '</p>'; ?> </div> <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> <p class="give-clearfix"> <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?> "><?php _e('Add Note', 'give');
function give_ajax_store_payment_note() { $payment_id = absint($_POST['payment_id']); $note = wp_kses($_POST['note'], array()); if (!current_user_can('edit_give_payments', $payment_id)) { wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); } if (empty($payment_id)) { die('-1'); } if (empty($note)) { die('-1'); } $note_id = give_insert_payment_note($payment_id, $note); die(give_get_payment_note_html($note_id)); }