NF_Notification_Success_Message

Class for our success message notification type.

Defined (1)

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

/deprecated/classes/notification-success-message.php  
  1. class NF_Notification_Success_Message extends NF_Notification_Base_Type 
  2.  
  3. /** 
  4. * Get things rolling 
  5. */ 
  6. function __construct() { 
  7. $this->name = __( 'Success Message', 'ninja-forms' ); 
  8.  
  9. /** 
  10. * Output our edit screen 
  11. *  
  12. * @access public 
  13. * @since 2.8 
  14. * @return void 
  15. */ 
  16. public function edit_screen( $id = '' ) { 
  17. $settings = array( 
  18. 'textarea_name' => 'settings[success_msg]',  
  19. ); 
  20. $loc_opts = apply_filters( 'nf_success_message_locations',  
  21. array( 
  22. array( 'action' => 'ninja_forms_display_before_fields', 'name' => __( 'Before Form', 'ninja-forms' ) ),  
  23. array( 'action' => 'ninja_forms_display_after_fields', 'name' => __( 'After Form', 'ninja-forms' ) ),  
  24. ); 
  25. ?> 
  26. <!-- <tr> 
  27. <th scope="row"><label for="success_message_loc"><?php _e( 'Location', 'ninja-forms' ); ?></label></th> 
  28. <td> 
  29. <select name="settings[success_message_loc]"> 
  30. <?php 
  31. foreach ( $loc_opts as $opt ) { 
  32. ?> 
  33. <option value="<?php echo $opt['action'];?>" <?php selected( nf_get_object_meta_value( $id, 'success_message_loc' ), $opt['action'] ); ?>><?php echo $opt['name'];?></option> 
  34. <?php 
  35. ?> 
  36. </select> 
  37. </td> 
  38. </tr> --> 
  39. <tr> 
  40. <th scope="row"><label for="success_msg"><?php _e( 'Message', 'ninja-forms' ); ?></label></th> 
  41. <td> 
  42. <?php wp_editor( nf_get_object_meta_value( $id, 'success_msg' ), 'success_msg', $settings ); ?> 
  43. </td> 
  44. </tr> 
  45.  
  46. <?php 
  47.  
  48. /** 
  49. * Process our Success Message notification 
  50. *  
  51. * @access public 
  52. * @since 2.8 
  53. * @return void 
  54. */ 
  55. public function process( $id ) { 
  56. global $ninja_forms_processing; 
  57.  
  58. // We need to get our name setting so that we can use it to create a unique success message ID. 
  59. $name = Ninja_Forms()->notification( $id )->get_setting( 'name' ); 
  60. // If our name is empty, we need to generate a random string. 
  61. if ( empty ( $name ) ) { 
  62. $name = ninja_forms_random_string( 4 ); 
  63. $success_msg = apply_filters( 'nf_success_msg', Ninja_Forms()->notification( $id )->get_setting( 'success_msg' ), $id ); 
  64. $success_msg = do_shortcode( wpautop( $success_msg ) ); 
  65. $success_msg = nf_parse_fields_shortcode( $success_msg ); 
  66. $ninja_forms_processing->add_success_msg( 'success_msg-' . $name, $success_msg );