edd_ajax_store_payment_note

The Easy Digital Downloads edd ajax store payment note function.

Description

edd_ajax_store_payment_note(); 

Usage

  1. if ( !function_exists( 'edd_ajax_store_payment_note' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'easy-digital-downloads/includes/admin/payments/actions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = edd_ajax_store_payment_note(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/payments/actions.php  
  1. function edd_ajax_store_payment_note() { 
  2.  
  3. $payment_id = absint( $_POST['payment_id'] ); 
  4. $note = wp_kses( $_POST['note'], array() ); 
  5.  
  6. if( ! current_user_can( 'edit_shop_payments', $payment_id ) ) { 
  7. wp_die( __( 'You do not have permission to edit this payment record', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) ); 
  8.  
  9. if( empty( $payment_id ) ) 
  10. die( '-1' ); 
  11.  
  12. if( empty( $note ) ) 
  13. die( '-1' ); 
  14.  
  15. $note_id = edd_insert_payment_note( $payment_id, $note ); 
  16. die( edd_get_payment_note_html( $note_id ) );