Cornerstone Forms Actions

Do this or that with Actions. In this article we explain everything to do with Actions

  1. Post Actions
  2. User Actions
  3. Term Actions
  4. Misc.
  5. Extra Actions
  6. Advanced Actions
  7. See Also

Actions are what tells your Forms to do something. Actions range from Updating a Post, to sending an email, to deleting a user.

Actions can have inner actions. Certain actions also return data that you can use in another Action. For example creating a Post will return a new Post ID. You can utilize that Post ID to update an ACF field or send that new Post ID via Email.

Post Actions

Post Create / Update

This will either create or update a Post depending on if you add in an "ID" field.

Post Create

Post Delete

This will delete or trash a Post depending on if you specify it should go into the trash.

Post Delete

Post Meta Update

This will update a post meta key or create a post meta key if none exists.

Using the "multiple" control, it won't update a meta key if it already exists, rather it will add in another value for the meta key. Both values will be accessible.

Post Meta Update

Post Meta Delete

This will delete post meta by a meta key.

Post Meta Delete

User Actions

User Create / Update

This action is capable of both creating and updating a user. Simply set the User ID to update a User.

This action sends back the ID of the user created or updated.

User Create

User Delete

This action will delete a User based on an ID.

If no ID is specified the action will cause a Form error.

User Delete

User Meta Update

This action will update a user meta key.

User Meta Update

User Meta Delete

This action will delete a users meta key by the User ID and the Meta Key

User Meta Delete

User Password Reset

This will reset users password to the password you provide to the action.

Password Reset Action

Login

Pass in a username or email and then a password and you can login a User.

Login Action

Term Actions

Terms / Taxonomy are a very encompassing system in WordPress. They refer to everything from Categories, to Product Brands in WooCommerce. They are way to relate posts to other posts through a shared attribute.

Term Create / Update

Based on a taxonomy create or update a term.

This action will return the Term ID created or just updated.

Term Create

Term Delete

This action will delete a term based on the ID you provide it.

Term Delete

Misc.

Email Action

This action will send out an email.

This action does require an emailing plugin to work properly. See this plugin as a good recommendation. In these emailing plugins you will actually connect your site with an email provider like SendGrid, or Gmail. This is required to not put your email into spam.

Email Action

Redirect

This action will redirect the users page. It's important to note that any action after this action will not run, because the users page will have been redirected. You should almost always set this as the final action in your chain.

Redirect

File Upload

This action will take the name of your file input and create a media entry in your WordPress site. It is capable of handling multiple files at once too.

File Upload

Custom Error

Custom Error can be used when you have a custom validation not supported by our validation system. With a Custom Error you can utilize our conditions to display an error when a condition is met.

Custom Error

External API Actions

You will need the External API enabled for these actions to show up in Cornerstone.

This section refers to both External API and Global External API. This action is capable of sending a request to another server. Commonly in the form world you would use this to send a webhook. For example the Slack Message action sends a webhook to Slack and then slack displays your custom message into a Slack channel.

External API

Extra Actions

Slack Message

Slack message will send a message to slack channel. There are two fields.

  • URL, This is the webhook URL you will grab from the slack dashboard. We will look into setting this up in the next seciton.
  • Message, This is the message for the slack channel. This can utilize form data and can be a useful message that let's your team know a form has been processed.

To setup a slack webhook URL, go into the Slack App Page. Click Create New App. Use From Scratch if you don't have a manifest. From here you will be guided which Workspace to use, and what the App name is.

Slack API Dashboard

When you are done creating the app, navigate to the Incoming Webhooks. Turn this feature one. At the bottom of the page there will be a section to create a new webhook. When you select this you will be able to select which Workspace channel to use. From here you will be given a URL. You will use this webhook in the URL control of the Slack Message action.

Slack Message

MailChimp

Mailchimp is a great way to manage email marketing. With Cornerstone Forms you can add new users or remove users from your email lists. The Mailchimp Subscribe action has a couple of controls related to subscribing or unsubscribing a user.

  • API Key, it's best to set this at the site level via the Cornerstone Settings
  • List, this is the email list to alter. This select box is autopopulated when you set your API key in the Cornerstone Settings.
  • Email, The user email to subscrbe or unsubscribe.
  • Status, This is the subscription status. You can select Subscribe, Unsubscribe. There is also a Pending status, but you probably don't need to use this.
  • First Name and Last Name, these add additional info to the user subscription. They are not required.
Mailchimp Subscribe

To grab a Mailchimp API key, go into the mailchimp console. You can also place this key in the Cornerstone Forms Settings MailChimp section to auto file the list control.

Mailchimp Settings

Advanced Actions

Advanced actions are the point you realize there are no limits to what you can do with Cornerstone Forms. With great power comes great responsibility though, and caution should be used with all of these actions. Consider testing these actions in a staging environment before adding them to a live site.

You can enable these actions in the Cornerstone Settings in the Forms Tab. Simply enable Advanced Mode and save and you will see these new actions available to add in your forms.

Advanced Mode Settings

SQL Action

This action will run a SQL statement. You can pass in arguments to this action and utilize them via %s and other modifiers. The following example will update a database option.

UPDATE wp_options SET option_value = %s WHERE option_name = %s
SQL Action

PHP Action

This action will run generic PHP. You do NOT need to add in the <?php tags. You can utilize the form data via the variable $formData.

// Loop form data and do something foreach ($formData as $key => $value) { // do something... }
PHP Action

See Also

See something inaccurate? Let us know