• WordPress
  • Is there a Contactform7 integration?

Hi there,
On my Wordpress installations the standard contact form is contactform7. Is there a way to let users subscribe to a newsletter list?
I run AcyMailing Enterprise 6.1.9 on the latest Wordpress and cf7 installations.
Thank you in advance
Frank

Hi,

I'm not familiar with ContactForm7, but if iut can run a script after submission you could use that to add users to your mailing list.

Maybe this thread is helpful for you.

9 days later

Thank you for your quick reply and sorry that I did not show up here since a while.

Thank you for the link. Didn't it lead to a Joomla Topic? Anyway I am not a programmer. So I did not find out how to handle the suggested solutions.
This is the plan: I need a popup with a newsletter subscription.
For Wordpress I am now working on these two options:
1 Use contactform7 and transfer the subscriber's data manually to Acymailing.
2 Use the Acy widget and place it by shortcode in the popup.

If you have another solution it will be very welcome.
Kind regards
Frank

5 days later

Yes, the link leads to a Joomla thread. The code however is just php code to add your user to your Acymailing list. That should work in Wordpress as well. You just need to figure out how you can run that php script after your form submission. I'm not familiar with contactform7, so I can't help you any further this.

Maybe @Remi_Acyba can put you on the right track.

Hi,

After some research you can do something like that:

add_action('wpcf7_before_send_mail', 'call_after_for_submit');
function call_after_for_submit($contact_data)
{
    include_once(rtrim(JPATH_ADMINISTRATOR, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acym'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');
    $userClass = acym_get('class.user');

    $myUser = $userClass->getOneByEmail(strip_tags($postData['RSEProEmail']));

    if (empty($myUser)) {
        $myUser = new stdClass();
    }

    $myUser = new stdClass();
    $myUser->email = strip_tags($post['your-email-field']); // Email field
    $myUser->name = strip_tags($post['your-email-field']); // Name field
    $myUser->id = $userClass->save($myUser, $customFields);
    $listToSubscribe = [1, 4]; // id of your lists separeted by commas
    $userClass->subscribe($myUser->id, $listToSubscribe);
    $userClass->sendConfirmation($myUser->id);
}

I'm not 100% sure of this code make sure to test it in a test environment.

    Thank your for these suggestions.
    @Remi_Acyba : Wer should I place your code? I found a submission.php in the contactform7 folder. On line 364 it has a paragraph "mail". Is that the right "environment"?

    Kind regards
    Frank

    Thank you for your very quick answer
    I copied your code to functions.php - but it had no effect.
    I changed "your-email-field" to "your-email" and adjusted the lists - still no effect.
    Contactform7 works as expected - but the sender does not appear on the Acymailing List.
    Kind regards
    Frank

      absatzweise You should rename "your-email-field" to the fieldname of the actual e-mail field of your form.

      2 months later

      Hello. There is an option which you can use -
      Redirection for Contact Form 7 for wordpress - it is an extension of CF7 with ability to add scripts to run after form sent successfully.
      My question is - how should the script look like, If I want to subscribe user to a list on another joomla! platform? I guess it won't be hard for anyone with programming skills.

      thanks a lot for help.

      Hi,

      You could use the subscription link for this. The technical documentations are still missing, here is the link needed if you want to insert a direct subscription link somewhere on your site:

      Joomla: https://yoursite.com/index.php?option=com_acym&ctrl=frontusers&task=subscribe&hiddenlists=1&user[email]=email%40example.com

      WordPress: https://yoursite.com/wp-admin/admin-ajax.php?page=acymailing_front&ctrl=frontusers&task=subscribe&hiddenlists=1&user[email]=email%40example.com&action=acymailing_frontrouter&noheader=1

      You could also take a look at the v5 documentation (Please note that you should cchange com_acymailing into com_acym):

      https://www.acyba.com/acymailing/106-acymailing-subscription-url.html

      Example: https://www.acyba.com/acymailing/127-acymailing-rsformpro.html#curl

      8 months later

      Remi_Acyba
      Hello,
      I have copied the code into my function.php and adjusted the field names and list ID. Unfortunately the registration to an Acymailling list does not work. What am I doing wrong?
      Is there a way to add a confirmation field that will only add the email to the mailing list if it is confirmed?
      Thanks for your help.