hi,
thanks in advance to those who can help me.
I am using wordpress with the "wpform" plugin.
I need to subscribe the user to a acymailing list after the form has been submitted.
In the wpform guide, I must use a function to do it. link I, have to insert the acymailing code in the wpform function.
If the acymailing code is not used in the wpform's function it executes the subscriptions.
If instead it is used in the function it generates errors.
Notice: Undefined index: formid in C:\inetpub\wwwroot\wordpress\wp-content\plugins\code-snippets\php\snippet-ops.php(446) : eval()'d code on line 4
Notice: Undefined property: stdClass::$id_form in C:\inetpub\wwwroot\wordpress\wp-content\plugins\code-snippets\php\snippet-ops.php(446) : eval()'d code on line 16
How can I solve it?
this is my complete code:
`function wpf_dev_process_complete( $fields, $entry, $form_data, $entry_id ) {
//start code that works when used without the wpform function
if(!include_once(WP_PLUGIN_DIR.DS.'acymailing'.DS.'back'.DS.'helpers'.DS.'helper.php')){
echo 'This code can not work without the AcyMailing Component';
return false;
}
define('WP_USE_THEMES', false);
require('C:\inetpub\wwwroot\wordpress/wp-load.php');
$emailocell="dioaerlex@alex.it";
$myUser = new stdClass();
$myUser->email = $emailocell ;
$userClass = acym_get('class.user');
$myUser->id = $userClass->save($myUser, $customFields);
$listToSubscribe = array(1); // id de listes séparées par une virgule
$userClass->subscribe($myUser->id, $listToSubscribe);
$subscribe = array(3); // Id of the lists you want the user to be subscribed to (can be empty)
$acyUserId = $user; // you can use the previous example code to get the user by its site user id or its email address
//end code that works when used without the wpform function
}
add_action( 'wpforms_process_complete', 'wpf_dev_process_complete', 10, 4 );`