Cornerstone Forms and Mailster

Hello.

What would be the process to send form submissions as a new subscriber in Mailster?

Thank you!

Hey @sprod,

Regretfully, there is currently no way in Cornerstone Forms to send submissions as a new subscriber in Mailster. That would require, custom development which we do not provide.

If you’re interested in doing this yourself or have a developer, the the process involves creating a new Action element that maps your form inputs to the Mailster subscriber API.

Please just note that the following instruction is not tested. It is only theoretical. The purpose is to give ideas how to proceed. We will not support any issues that may arise from the use of the following instructions.

1. Create a Custom Action File

The most robust way to add this without modifying the core plugin is to add the following code to your child theme’s functions.php or a custom snippet plugin.

2. Implement the Mailster Action

You need to use cs_form_action_register() to define the action. This requires three main parts:

  • Values : Defines the configuration keys (e.g., Email field, List ID).
  • Controls : Defines how these settings appear in the Cornerstone builder UI.
  • Render : The logic that runs when the form is submitted, using Mailster’s PHP API.

Sample Implementation

Here is a starting point for a Mailster integration. This code uses the recommended mailster('subscribers')->add() method.

add_action('cs_forms_booted', function() {

    // 1. Define the Action Configuration
    cs_form_action_register('cornerstone-actions-mailster-subscribe', [
        'title'  => __('Mailster Subscribe', 'cornerstone'),
        'icon'   => 'email', // Or a custom SVG path
        'values' => [
            'email_field' => cs_value('', 'markup'),
            'firstname'   => cs_value('', 'markup'),
            'lastname'    => cs_value('', 'markup'),
            'list_id'     => cs_value('', 'markup'),
            'status'      => cs_value(1, 'markup:int'), // 1 = Subscribed, 0 = Pending
        ],
        'builder' => function() {
            return [
                'control_nav' => [
                    'element'         => __( 'Action', 'cornerstone' ),
                    'element:general' => __( 'General', 'cornerstone' ),
                ],
                'controls' => [
                    [
                        'type'     => 'group',
                        'group'    => 'element:general',
                        'controls' => [
                            [ 'key' => 'email_field', 'type' => 'text', 'label' => __('Email Field Name', 'cornerstone'), 'options' => [ 'placeholder' => 'email' ] ],
                            [ 'key' => 'firstname',   'type' => 'text', 'label' => __('First Name', 'cornerstone') ],
                            [ 'key' => 'lastname',    'type' => 'text', 'label' => __('Last Name', 'cornerstone') ],
                            [ 'key' => 'list_id',     'type' => 'text', 'label' => __('List ID', 'cornerstone') ],
                            [ 
                                'key' => 'status', 
                                'type' => 'select', 
                                'label' => __('Status', 'cornerstone'),
                                'options' => [ 'choices' => [ ['value' => 1, 'label' => 'Subscribed'], ['value' => 0, 'label' => 'Pending'] ] ]
                            ],
                        ],
                    ],
                ]
            ];
        },
        'render' => function($data) {
            // Ensure Mailster is active
            if ( ! function_exists( 'mailster' ) ) {
                throw new \Exception('Mailster is not active.');
            }

            // Get the data from the submitted form inputs
            $subscriber_data = [
                'email'     => $data['email_field'],
                'firstname' => $data['firstname'],
                'lastname'  => $data['lastname'],
                'status'    => (int) $data['status'],
            ];

            // Add the subscriber (overwrite: true)
            $subscriber_id = mailster( 'subscribers' )->add( $subscriber_data, true );

            if ( is_wp_error( $subscriber_id ) ) {
                throw new \Exception( $subscriber_id->get_error_message() );
            }

            // Assign to list if ID is provided
            if ( ! empty( $data['list_id'] ) ) {
                mailster( 'subscribers' )->assign_lists( $subscriber_id, (int) $data['list_id'] );
            }

            return $subscriber_id;
        }
    ]);
});

How to use it in Cornerstone

  1. Add the code above to your site.
  2. Open the Cornerstone Builder on the page with your form.
  3. Add an Action element inside your Form element.
  4. In the Action Type dropdown, you will see Mailster Subscribe .
  5. Map your form fields using Dynamic Content (e.g., {{dc:form:input key="email"}} ) into the First Name, Last Name, and Email fields of the action.

Hi @christian

Thank you for your detailed reply which I appreciate.

That’s a shame as I was really looking forward to using CS Forms as most of my client sites use Mailster.

I almost seems like it wouldn’t even take that much effort for you/ThemeCo to have this available in an upcoming update with the code you supplied.

Is there a chance for this compatibility in a near upcoming update?

I appreciate it very much.

Thank you!

Hi @christian

In addition to my other response; is it possible to connect with Close CRM (https://close.com/)?

Thanks!

Hello @sprod,

Regretfully, connecting to Close CRM is also not possible. If you are interested in having a custom integration built, please contact us here. Tell us more about the integration, and we can send over a quote.

Best Regards.

Thank you @ruenel

Did you see this message: Cornerstone Forms and Mailster

Appreciate it!

Hello @sprod,

Thank you for your suggestion—we’ve added it to our feature requests. It may be prioritized based on internal voting and feedback from other customers regarding Mailster integration.

We’d also be happy to assist with custom integrations for Cornerstone Forms. Please share your details here at your convenience, and we’ll promptly send you a personalized quotation.

Thanks

Yes, I think cross compatibility is important especially with something like Zapier to send data.

Thank you, I appreciate it!

You are most welcome, @sprod