Title: Ninja Forms needs a success_message_action() PHP function
Last modified: October 13, 2017

---

# Ninja Forms needs a success_message_action() PHP function

 *  Resolved [deeveedee](https://wordpress.org/support/users/deeveedee/)
 * (@deeveedee)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/ninja-forms-needs-a-success_message_action-php-function/)
 * I’ve been exploring multiple ways to create a custom success message action in
   real time based on the result of a custom callback in my WP Hook. After extensive
   exploration, it seems to me that there is a glaring hole in Ninja Forms 3.x. 
   Shouldn’t there be a simple way to create a custom Success Message via a success_message_action()
   PHP function? The success_message_action() function should accept the success
   message string as one of the arguments.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [deeveedee](https://wordpress.org/support/users/deeveedee/)
 * (@deeveedee)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/ninja-forms-needs-a-success_message_action-php-function/#post-9588739)
 * In order to create a custom Success Message that is unique to each custom Action,
   I removed the WP Hook from my form (leaving only the Success Message Action as
   the single Action in my form) and moved my custom Action functinoality (formerly
   in the WP Hook callback) to a `ninja_forms_run_action_settings` filter. Now, 
   after form submission, my action processing filter performs my custom Action 
   and modifies the Success Message’s `$action_settings['success_msg']`before returning`
   $action_settings`.
 * Using this technique, I can have a Success Message that displays the unique result
   of my custom Action. For example, my custom Action (now performed in the filter)
   submits the form data to an external helpdesk database which returns a helpdesk
   ticket number. Before exiting, the filter adds the helpdesk ticket number to 
   the success message to be displayed to the user.
 * Note that my custom Action which I moved to the filter needs read-only access
   to the form field values. Since I don’t know enough (yet) about Ninja Forms to
   directly access form data in the filter, my filter extracts the form field values
   from `$action_settings['email_message']`. This is the only way I could find to
   get the form field values using the data provided to the filter.
 *  Thread Starter [deeveedee](https://wordpress.org/support/users/deeveedee/)
 * (@deeveedee)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/ninja-forms-needs-a-success_message_action-php-function/#post-9605588)
 * Marking this as resolved, since I was able to find a way to achieve the desired
   result with a custom `ninja_forms_run_action_settings` filter. I think Ninja 
   Forms should provide an easier way to display real-time results from the WP Hook
   Action in the Success Message.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Ninja Forms needs a success_message_action() PHP function’ is closed 
to new replies.

 * ![](https://ps.w.org/ninja-forms/assets/icon-256x256.png?rev=1649747)
 * [Ninja Forms - The Contact Form Builder That Grows With You](https://wordpress.org/plugins/ninja-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ninja-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ninja-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/ninja-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ninja-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ninja-forms/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [deeveedee](https://wordpress.org/support/users/deeveedee/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/ninja-forms-needs-a-success_message_action-php-function/#post-9605588)
 * Status: resolved