Registering Actions

Actions Overview

The Ninja Forms Action System is how Ninja Forms processes form submission data.

Submission Actions are like modules which can be added to a form.

Multiple actions can be added to a single form, and likewise, a single Action Type can be added to multiple forms.

Actions extend the NF_Abstracts_Action base class.

Registration

Name

The $_name property is a unique slug used to identify the action type.

Nicename

The $_nicename property is displayed in the builder when a user adds an action to a form. The nicename should be a translated string, thus should be set in the action class constructor.

Tags

The $_tags property is an array of keywords which are used when searching, or filtering, actions in the builder. These keywords are used in addition to the action nicename for search results.

Processing Order

Timing

The $_timing property is used to group actions during processing, which are then weighted by the $_priority property.

Available Timing Options:

Early

Early actions process before Normal and before Late.

These actions do not rely on processed data or are required for other actions.

Examples: Collecting Payments

Normal

Normal actions process after Early and before Late.

These actions have access to the processed results of the early actions.

Examples: Newsletter Signups

Late

Late actions process after Early and after Normal.

These actions can rely on other processing, but should not make any changes that other actions should rely on.

Examples: Success Messages, Redirects, Emails.

Priority

The $_priority property is used to weight the action processing order within the $_timing groups.

Action Settings

The $_settings property accepts an array of settings, following an array format shared with Fields.

For a list of accepted settings properties and a list of basic settings, see the article on Settings Configuration.

“Extra” Data

For saving “extra” data during submission, data that is not field data, update the extra key in the $data parameter before returning.