edd_admin_messages

Admin Messages.

Description

edd_admin_messages(); 

Usage

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

Defined (1)

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

/includes/admin/admin-notices.php  
  1. function edd_admin_messages() { 
  2. global $edd_options; 
  3.  
  4. if ( isset( $_GET['edd-message'] ) && 'discount_added' == $_GET['edd-message'] && current_user_can( 'manage_shop_discounts' ) ) { 
  5. add_settings_error( 'edd-notices', 'edd-discount-added', __( 'Discount code added.', 'edd' ), 'updated' ); 
  6.  
  7. if ( isset( $_GET['edd-message'] ) && 'discount_add_failed' == $_GET['edd-message'] && current_user_can( 'manage_shop_discounts' ) ) { 
  8. add_settings_error( 'edd-notices', 'edd-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'edd' ), error ); 
  9.  
  10. if ( isset( $_GET['edd-message'] ) && 'discount_exists' == $_GET['edd-message'] && current_user_can( 'manage_shop_discounts' ) ) { 
  11. add_settings_error( 'edd-notices', 'edd-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'edd' ), error ); 
  12.  
  13. if ( isset( $_GET['edd-message'] ) && 'discount_updated' == $_GET['edd-message'] && current_user_can( 'manage_shop_discounts' ) ) { 
  14. add_settings_error( 'edd-notices', 'edd-discount-updated', __( 'Discount code updated.', 'edd' ), 'updated' ); 
  15.  
  16. if ( isset( $_GET['edd-message'] ) && 'discount_update_failed' == $_GET['edd-message'] && current_user_can( 'manage_shop_discounts' ) ) { 
  17. add_settings_error( 'edd-notices', 'edd-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'edd' ), error ); 
  18.  
  19. if ( isset( $_GET['edd-message'] ) && 'payment_deleted' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) { 
  20. add_settings_error( 'edd-notices', 'edd-payment-deleted', __( 'The payment has been deleted.', 'edd' ), 'updated' ); 
  21.  
  22. if ( isset( $_GET['edd-message'] ) && 'email_sent' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) { 
  23. add_settings_error( 'edd-notices', 'edd-payment-sent', __( 'The purchase receipt has been resent.', 'edd' ), 'updated' ); 
  24.  
  25. if ( isset( $_GET['edd-message'] ) && 'payment-note-deleted' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) { 
  26. add_settings_error( 'edd-notices', 'edd-payment-note-deleted', __( 'The payment note has been deleted.', 'edd' ), 'updated' ); 
  27.  
  28. if ( isset( $_GET['page'] ) && 'edd-payment-history' == $_GET['page'] && current_user_can( 'view_shop_reports' ) && edd_is_test_mode() ) { 
  29. add_settings_error( 'edd-notices', 'edd-payment-sent', sprintf( __( 'Note: Test Mode is enabled, only test payments are shown below. <a href="%s">Settings</a>.', 'edd' ), admin_url( 'edit.php?post_type=download&page=edd-settings' ) ), 'updated' ); 
  30.  
  31. if ( ( empty( $edd_options['purchase_page'] ) || 'trash' == get_post_status( $edd_options['purchase_page'] ) ) && current_user_can( 'edit_pages' ) && ! get_user_meta( get_current_user_id(), '_edd_set_checkout_dismissed' ) ) { 
  32. echo '<div class="error">'; 
  33. echo '<p>' . sprintf( __( 'No checkout page has been configured. Visit <a href="%s">Settings</a> to set one.', 'edd' ), admin_url( 'edit.php?post_type=download&page=edd-settings' ) ) . '</p>'; 
  34. echo '<p><a href="' . add_query_arg( array( 'edd_action' => 'dismiss_notices', 'edd_notice' => 'set_checkout' ) ) . '">' . __( 'Dismiss Notice', 'edd' ) . '</a></p>'; 
  35. echo '</div>'; 
  36.  
  37. if ( isset( $_GET['edd-message'] ) && 'settings-imported' == $_GET['edd-message'] && current_user_can( 'manage_shop_settings' ) ) { 
  38. add_settings_error( 'edd-notices', 'edd-settings-imported', __( 'The settings have been imported.', 'edd' ), 'updated' ); 
  39.  
  40. if ( isset( $_GET['edd-message'] ) && 'note-added' == $_GET['edd-message'] && current_user_can( 'edit_shop_payments' ) ) { 
  41. add_settings_error( 'edd-notices', 'edd-note-added', __( 'The payment note has been added successfully.', 'edd' ), 'updated' ); 
  42.  
  43. if ( isset( $_GET['edd-message'] ) && 'payment-updated' == $_GET['edd-message'] && current_user_can( 'edit_shop_payments' ) ) { 
  44. add_settings_error( 'edd-notices', 'edd-payment-updated', __( 'The payment has been successfully updated.', 'edd' ), 'updated' ); 
  45.  
  46. if ( isset( $_GET['edd-message'] ) && 'api-key-generated' == $_GET['edd-message'] && current_user_can( 'manage_shop_settings' ) ) { 
  47. add_settings_error( 'edd-notices', 'edd-api-key-generated', __( 'API keys successfully generated.', 'edd' ), 'updated' ); 
  48.  
  49. if ( isset( $_GET['edd-message'] ) && 'api-key-failed' == $_GET['edd-message'] && current_user_can( 'manage_shop_settings' ) ) { 
  50. add_settings_error( 'edd-notices', 'edd-api-key-failed', __( 'The specified user already has API keys or the specified user does not exist..', 'edd' ), error ); 
  51.  
  52. if ( isset( $_GET['edd-message'] ) && 'api-key-regenerated' == $_GET['edd-message'] && current_user_can( 'manage_shop_settings' ) ) { 
  53. add_settings_error( 'edd-notices', 'edd-api-key-regenerated', __( 'API keys successfully regenerated.', 'edd' ), 'updated' ); 
  54.  
  55. if ( isset( $_GET['edd-message'] ) && 'api-key-revoked' == $_GET['edd-message'] && current_user_can( 'manage_shop_settings' ) ) { 
  56. add_settings_error( 'edd-notices', 'edd-api-key-revoked', __( 'API keys successfully revoked.', 'edd' ), 'updated' ); 
  57.  
  58. if( ! edd_htaccess_exists() && ! get_user_meta( get_current_user_id(), '_edd_htaccess_missing_dismissed', true ) && current_user_can( 'manage_shop_settings' ) ) { 
  59. if( ! stristr( $_SERVER['SERVER_SOFTWARE'], 'apache' ) ) 
  60. return; // Bail if we aren't using Apache... nginx doesn't use htaccess! 
  61.  
  62. echo '<div class="error">'; 
  63. echo '<p>' . sprintf( __( 'The Easy Digital Downloads .htaccess file is missing from <strong>%s</strong>!', 'edd' ), edd_get_upload_dir() ) . '</p>'; 
  64. echo '<p>' . sprintf( __( 'First, please resave the Misc settings tab a few times. If this warning continues to appear, create a file called ".htaccess" in the <strong>%s</strong> directory, and copy the following into it:', 'edd' ), edd_get_upload_dir() ) . '</p>'; 
  65. echo '<p><pre>' . edd_get_htaccess_rules() . '</pre>'; 
  66. echo '<p><a href="' . add_query_arg( array( 'edd_action' => 'dismiss_notices', 'edd_notice' => 'htaccess_missing' ) ) . '">' . __( 'Dismiss Notice', 'edd' ) . '</a></p>'; 
  67. echo '</div>'; 
  68.  
  69. if( ! get_user_meta( get_current_user_id(), '_edd_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_shop_settings' ) && false !== get_transient( '_edd_ajax_works' ) ) { 
  70.  
  71. if( ! edd_test_ajax_works() ) { 
  72.  
  73. echo '<div class="error">'; 
  74. echo '<p>' . __( 'Your site appears to be blocking the WordPress ajax interface. This may causes issues with your store.', 'edd' ) . '</p>'; 
  75. echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'edd' ), 'https://easydigitaldownloads.com/docs/admin-ajax-blocked' ) . '</p>'; 
  76. echo '<p><a href="' . add_query_arg( array( 'edd_action' => 'dismiss_notices', 'edd_notice' => 'admin_ajax_inaccessible' ) ) . '">' . __( 'Dismiss Notice', 'edd' ) . '</a></p>'; 
  77. echo '</div>'; 
  78.  
  79.  
  80. settings_errors( 'edd-notices' );