Converting GravityForms Entries into Subscribers

Updated on Jan 25, 2023

If you wish to store your client’s contact information in the WP SMS newsletter using GravityForms, the following function will assist you in doing so easily.

/**
 * @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);