« Return to FAQ Database

Integrate Gravity Forms with UCM Newsletters

If you are using Gravity Forms on your WordPress website and wish to subscribe people to UCM Newsletters please try this code in your WordPress functions.php file:

add_action('gform_after_submission', 'post_to_ucm', 10, 2);
function post_to_ucm($entry, $form) {
    $post_url = 'http://url_to_your_website.com/your_ucm_folder/external/m.member/h.subscribe';
    $body = array(
        'member[first_name]' => $entry['1'],
        'member[last_name]' => $entry['2'],
        'member[email]' => $entry['3']
    $request = new WP_Http();
    $response = $request->post($post_url, array('body' => $body));

Thanks Sven!

This FAQ Entry was created on: 2013-03-31 19:58:14
This FAQ Entry was last updated on: 0000-00-00 00:00:00