×

info

Dear guests,
You are currently on the old forum we kept as a knowledge base. You will find the new community forum here
Welcome, Guest
Username: Password: Remember me
Keyword

TOPIC: Subscribe user to a list if checkbox RsFormPro! is ticked

Subscribe user to a list if checkbox RsFormPro! is ticked 3 years 7 months ago #106671

  • Anonymous user
  • miracle's Avatar
  • Posts: 42
  • Karma: 1
I'm trying (but not succeeding) in getting RsFormPro! and Acymailing working together as described in www.acyba.com/acymailing/127-acymailing-rsformpro.html

I have an active list in Acymailing with ID 1. I have added a checkbox field 'subscribeme' to a current form in RsFormPro! and gave it one item to choose from 'Yes, I want the newsletter'. I added the code below to the PHP-script area in this form in the part 'Script called after form has been processed'. So I thought I had done all I needed to do. But It's not working.....


$postData = JRequest::getVar('form');
if(empty($postData['subscribeme'])) return;
 
 
include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');
 
 $myUser = new stdClass();
 $myUser->email = strip_tags($postData['E-mail']);
 $myUser->name = strip_tags($postData['Naam']);
 $subscriberClass = acymailing_get('class.subscriber');
 
 $subscribe = array(1);
 
 $subid = $subscriberClass->save($myUser);
 
 
$subscriberClass->sendConf($subid); //we send the confirmation email... only if needed based on the current user status and the option from the Acy configuration page.
 
 $newSubscription = array();
 if(!empty($subscribe)){
 foreach($subscribe as $listId){
 $newList = array();
 $newList['status'] = 1;
 $newSubscription[$listId] = $newList;
 }
 }
 $subscriberClass->saveSubscription($subid,$newSubscription);
Last Edit: 3 years 7 months ago by Tom.
Please log in to post a reply

Subscribe user to a list if checkbox RsFormPro! is ticked 3 years 7 months ago #106693

  • Tom
  • Tom's Avatar
  • Posts: 4581
  • Karma: 188
Hello,

What is not working exactly?
Is it that your user is not subscribed? Or subscribed no matter the value of the item to be subscribed or not?
Have you checked the value of the subscribeme variable to be sure of the value and the test?
Is it a checkbox or another field type?
Please log in to post a reply
Time to create page: 0.097 seconds
Powered by Kunena Forum