50% OFF Limited time deal!

Convert entries form to subscribers after submitting new from in GravityForms

Updated on Mar 08, 2022

Sometimes you’d like to store your contact’s data in the WP-SMS newsletter, so here is a simple function that helps you to do that.

/**
 * @param $entry
 * @param $form
 */
function addNumberToSubscriberList($entry, $form)
{
    $name    = $entry[1]; // Field ID
    $mobile  = $entry[2]; // Field ID
    $groupId = $entry[3]; // Field ID

    \WP_SMS\Newsletter::addSubscriber($name, $mobile, $groupId, '1');
}
add_action('gform_after_submission', 'addNumberToSubscriberList', 10, 2);