FormBuilder: Add email to mail list in NMS?
FormBuilder: Add email to mail list in NMS?
Is there a way in FormBuilder to add, for instance, a checkbox to add users email to mail list in NMS?
I saw that there was an field type option: "Call A User Defined Tag With the Form Results". Waybe there´s a way to add this functionailty with a User Defined Tag.
Any suggestions on how to proceed?
I saw that there was an field type option: "Call A User Defined Tag With the Form Results". Waybe there´s a way to add this functionailty with a User Defined Tag.
Any suggestions on how to proceed?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: FormBuilder: Add email to mail list in NMS?
No, there is no built in integration between formbuilder and NMS.
However, you are correct, you should be able to write a UDT to subscribe/unsubscribe a person to a particular NMS list based on a checkbox in a formbuilder form.
However, you are correct, you should be able to write a UDT to subscribe/unsubscribe a person to a particular NMS list based on a checkbox in a formbuilder form.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: FormBuilder: Add email to mail list in NMS?
I made an UDT for this:
Subscribe is the name of the subscribe checkbox in FormBuilder, where values can be 'Yes' (checked) or 'No' (unchecked).
Code: Select all
if (!isset($params['Subscribe']) && !isset($params['E-mail']))
return;
$subscribe = $params['Subscribe'];
if ($subscribe != 'Yes')
return;
$name = '';
if (isset($params['Name']))
$name = $params['Name'];
global $gCms;
if (!isset($gCms->modules['NMS']))
return;
$nms = $gCms->modules['NMS']['object'];
$mid = 'm' . ++$gCms->variables["modulenum"];
$params['email'] = $params['E-mail'];
$params['username'] = $name;
// array with list id's
$params['lists'] = array(1);
// return id used for link in confirmation mail
$returnid = 65;
$nms->DoAction('do_create_new_user',$mid,$params,$returnid);
Last edited by sn3p on Thu Aug 27, 2009 3:48 pm, edited 1 time in total.
- chuckienorton
- Forum Members
- Posts: 68
- Joined: Wed Feb 14, 2007 6:58 pm
- Location: Pasadena, California
Re: FormBuilder: Add email to mail list in NMS?
SN3P, Thanks for how-to. But I'm confused... where does this code go? Do you mind giving just a little more detail for lesser mortals like myself?
Thanks man.
Thanks man.
Re: FormBuilder: Add email to mail list in NMS?
We (Eus and me) solved your problem.
- Create a UDT name it "subscription".
- Place the code above in it.
- Create in Formbuilder in your form a field of the type "*Call A User Defined Tag With the Form Results"
- Also create a checkbox as mentioned above in the formbuilder.
Grtz,
2nFuse
- Create a UDT name it "subscription".
- Place the code above in it.
- Create in Formbuilder in your form a field of the type "*Call A User Defined Tag With the Form Results"
- Also create a checkbox as mentioned above in the formbuilder.
Grtz,
2nFuse
Re: FormBuilder: Add email to mail list in NMS?
Thanks for the help with the UDT. I followed your instructions and pasted the code into a UDT named subscription, but after I hit submit, the form bounces from http://www.coachterri.com/archive to a 404 page not found:
http://www.coachterri.com/archive/index ... &m3error=1
The email isn't getting stored in the NMS database, but the send to email function that I have on the form still works. How can I modify the UDT to fix this? I just want the form to load the formbuilder submission template. I'm trying to figure this out on my own, but it's not going so well with my limited knowledge of php.
Also, is it possible to have the user subscribe without the addition of the checkbox? All I want the form to say is : Name ______ Email _______ Submit [] and when the submit button is clicked, the username and email are submitted to NMS.
Is this possible with the UDT, or is the checkbox an absolute necessity. It's not a huge deal if it's too difficult. Thanks so much!
Install Info:
CMSMS v.1.5.2
Blogs 0.3.3.1
Captcha 0.3.2
CGExtensions 1.15
CMSMailer 1.73.14
CustomContent 1.5.2
FileManager 0.4.3
FormBuilder 0.5.11
FrontEndUsers 1.6.2
MenuManager 1.5.3
ModuleManager 1.2.1
News 2.9.2
NMS 2.2
nuSOAP 1.0.1
Printing 0.2.6
Search 1.5.2
ThemeManager 1.0.8
TinyMCE 2.4.11
http://www.coachterri.com/archive/index ... &m3error=1
The email isn't getting stored in the NMS database, but the send to email function that I have on the form still works. How can I modify the UDT to fix this? I just want the form to load the formbuilder submission template. I'm trying to figure this out on my own, but it's not going so well with my limited knowledge of php.
Also, is it possible to have the user subscribe without the addition of the checkbox? All I want the form to say is : Name ______ Email _______ Submit [] and when the submit button is clicked, the username and email are submitted to NMS.
Is this possible with the UDT, or is the checkbox an absolute necessity. It's not a huge deal if it's too difficult. Thanks so much!
Install Info:
CMSMS v.1.5.2
Blogs 0.3.3.1
Captcha 0.3.2
CGExtensions 1.15
CMSMailer 1.73.14
CustomContent 1.5.2
FileManager 0.4.3
FormBuilder 0.5.11
FrontEndUsers 1.6.2
MenuManager 1.5.3
ModuleManager 1.2.1
News 2.9.2
NMS 2.2
nuSOAP 1.0.1
Printing 0.2.6
Search 1.5.2
ThemeManager 1.0.8
TinyMCE 2.4.11
Last edited by chrismarie on Mon Feb 09, 2009 9:17 pm, edited 1 time in total.
Re: FormBuilder: Add email to mail list in NMS?
Hi there,
first of all, this is my first post, I want to thank the whole team and community for the INCREDIBLE JOB... KEEP IT UP!
And now with the topic.
I had your same situation, did include the code on UDT and linked to a form with checkbox as described, when I first tested I had a similar error, got redirected to a URL with all the parameters listed on it, went through the code in the UDT and realized that my "email" field wasn't exactly identified as "E-mail", so I changed the "E-mail" identifier to match the name of my email field and it worked just perfect.
I mean that's what the code is doing, first is checking that the value of that field (email) isn't empty and then is using the value (stored in the variable to send to NMS) to send it to the newsletter list, so in order to do this it has to find the value of the specified field, and so if the field of the email (the user's email) can't be find (as the name of the field in the code is different from the name of the field in your form) then it's not possible to store the email on the NMS list thus we get the error.
Don't know if I've explained my self properly, in other words, change $params['E-mail'] (that you'll find twice in the provided code) to match the exact name of your email field.
And for the second part of your question, you can do that (form with Name and Email to NMS) exactly with this smarty:
{cms_module module='NMS' mode="subscribe" select="NAME OF YOUR NEWSLETTER LIST"}
With this you will get a form with 2 fields, one for the email and the other one for the Name, with a checkbox (marked and uneditable) and as label of that checkbox you get the name of your list and the description, haven't got to deep into that, but if you go into the NMS module and the Subscription tab, you will be able to edit that form, and with a bit of CSS you have it all done.
Well hope it all helps, and you can accomplish what you started.
I forgot THANKS FOR THE UDT AND THE WHOLE THREAD!! It helped me alot!
All the best!
first of all, this is my first post, I want to thank the whole team and community for the INCREDIBLE JOB... KEEP IT UP!
And now with the topic.
I had your same situation, did include the code on UDT and linked to a form with checkbox as described, when I first tested I had a similar error, got redirected to a URL with all the parameters listed on it, went through the code in the UDT and realized that my "email" field wasn't exactly identified as "E-mail", so I changed the "E-mail" identifier to match the name of my email field and it worked just perfect.
I mean that's what the code is doing, first is checking that the value of that field (email) isn't empty and then is using the value (stored in the variable to send to NMS) to send it to the newsletter list, so in order to do this it has to find the value of the specified field, and so if the field of the email (the user's email) can't be find (as the name of the field in the code is different from the name of the field in your form) then it's not possible to store the email on the NMS list thus we get the error.
Don't know if I've explained my self properly, in other words, change $params['E-mail'] (that you'll find twice in the provided code) to match the exact name of your email field.
And for the second part of your question, you can do that (form with Name and Email to NMS) exactly with this smarty:
{cms_module module='NMS' mode="subscribe" select="NAME OF YOUR NEWSLETTER LIST"}
With this you will get a form with 2 fields, one for the email and the other one for the Name, with a checkbox (marked and uneditable) and as label of that checkbox you get the name of your list and the description, haven't got to deep into that, but if you go into the NMS module and the Subscription tab, you will be able to edit that form, and with a bit of CSS you have it all done.
Well hope it all helps, and you can accomplish what you started.
I forgot THANKS FOR THE UDT AND THE WHOLE THREAD!! It helped me alot!
All the best!
Last edited by TxinO on Sat Feb 21, 2009 6:59 pm, edited 1 time in total.
Re: FormBuilder: Add email to mail list in NMS?
This worked great. Had a question:
When a user is created using this method the user had "confirmed - no" - is there a way to have the UDT send an email to the user for confirmation email OR have it automatically marked as "confirmed - yes"?
UPDATE: Actually it did send an confirmation email - but when I click on the email it goes to a "page not found"
When a user is created using this method the user had "confirmed - no" - is there a way to have the UDT send an email to the user for confirmation email OR have it automatically marked as "confirmed - yes"?
UPDATE: Actually it did send an confirmation email - but when I click on the email it goes to a "page not found"
Last edited by giggler on Thu May 21, 2009 7:25 am, edited 1 time in total.
Re: FormBuilder: Add email to mail list in NMS?
has someone got this working ?
I did this and the email is not added to my NMS list, i get no error's
kind regards
Peter
Sjoz wrote: We (Eus and me) solved your problem.
- Create a UDT name it "subscription".
- Place the code above in it.
- Create in Formbuilder in your form a field of the type "*Call A User Defined Tag With the Form Results"
- Also create a checkbox as mentioned above in the formbuilder.
Grtz,
2nFuse
I did this and the email is not added to my NMS list, i get no error's
kind regards
Peter
Re: FormBuilder: Add email to mail list in NMS?
maybe i did something wrongpedes wrote: has someone got this working ?
Sjoz wrote: We (Eus and me) solved your problem.
- Create a UDT name it "subscription".
- Place the code above in it.
- Create in Formbuilder in your form a field of the type "*Call A User Defined Tag With the Form Results"
- Also create a checkbox as mentioned above in the formbuilder.
Grtz,
2nFuse
I did this and the email is not added to my NMS list, i get no error's
kind regards
Peter
- made the UDT with the code above and named it "subscription"
- put a email field in the form, named it "E-mail"
- i also have a field for a username, named it "Name"
- i made a checkbox, named it "Subscribe" and let it standard 'checked'
- i made a field of the type "*Call A User Defined Tag With the Form Results", named it udt
is there something else to do ? my NMS list is created, i named it 'newsletter'
any idea ?
Kind regards,
Peter
Last edited by pedes on Wed May 26, 2010 5:12 pm, edited 1 time in total.
Re: FormBuilder: Add email to mail list in NMS?
I've discovered you need to give the 3 fields an alias in FormBuilder and then use these params names in your UDT before it works.
I've have also made an alternative UDT, based on Ted's UDT "FrontEndUsers to NMS (via SelfRegistration)" (http://forum.cmsmadesimple.org/index.php/topic,34004.0.html), setting the user to "Confirmed" without sending an email.
The params names are the field alias in FormBuilder!
I've have also made an alternative UDT, based on Ted's UDT "FrontEndUsers to NMS (via SelfRegistration)" (http://forum.cmsmadesimple.org/index.php/topic,34004.0.html), setting the user to "Confirmed" without sending an email.
Code: Select all
if (!function_exists('MyGetModuleInstance'))
{
function &MyGetModuleInstance($module)
{
global $gCms;
if (isset($gCms->modules[$module]) &&
$gCms->modules[$module]['installed'] == true &&
$gCms->modules[$module]['active'] == true)
{
return $gCms->modules[$module]['object'];
}
// Fix only variable references should be returned by reference
$tmp = FALSE;
return $tmp;
}
}
global $gCms;
$nms = MyGetModuleInstance('NMS');
if ($nms == FALSE)
return false;
if (!isset($params['subscribe']) && !isset($params['email']))
return;
$subscribe = $params['subscribe'];
if ($subscribe != 'Yes')
return;
$name = '';
if (isset($params['name']))
$name = $params['name'];
$email = '';
if (isset($params['email']))
$email = $params['email'];
//Add user to NMS
//array(1) -- represents the id of the mailing list to add them to. Change the 1 to whatever you want.
$nms->AddUser($email, array(1), $name);
//Set the confirmed flag to true (they clicked the checkbox -- that's enough)
$db =& $gCms->GetDb();
$db->Execute('UPDATE ' . cms_db_prefix() . 'module_nms_users SET confirmed = 1 where email = ?', array($email));
-
- Forum Members
- Posts: 137
- Joined: Thu Oct 26, 2006 9:20 am
- Location: Dresden - Saxony - Germany
Re: FormBuilder: Add email to mail list in NMS?
problem solved..
-
- Forum Members
- Posts: 103
- Joined: Fri Nov 28, 2008 11:26 am
Re: FormBuilder: Add email to mail list in NMS?
Hi all,
Can't get this to work in the latest CMSMS 1.10.3 / NMS 2.4.3 / formbuilder 0.7.2
Any ideas? Perhaps something has changed in the latest core to prevent it from working anymore?
I've followed all of the above instructions and carefully and tried the alternative UDT shared by webform, but still no joy.
Cheers.
Can't get this to work in the latest CMSMS 1.10.3 / NMS 2.4.3 / formbuilder 0.7.2
Any ideas? Perhaps something has changed in the latest core to prevent it from working anymore?
I've followed all of the above instructions and carefully and tried the alternative UDT shared by webform, but still no joy.
Cheers.
-
- Forum Members
- Posts: 127
- Joined: Fri Nov 28, 2008 10:28 pm
Re: FormBuilder: Add email to mail list in NMS?
Code: Select all
$gCms = cmsms();
$nms = cms_utils::get_module('NMS');
if(!is_object($nms))
return false;
if (!isset($params['name']) && !isset($params['email']) && !isset($params['list']))
return;
$name = '';
if (isset($params['name']))
$name = $params['name'];
$email = '';
if (isset($params['email']))
$email = $params['email'];
$list = '';
if (isset($params['list']))
$newslist = 1;
$list = 1;
//This is a mandatory list ID all should belong to
//Add user to NMS
$nms->AddUser($email, $list, $name);
echo $nms->AddUser($email, $list, $name);
//Set the confirmed flag to true
$db = cmsms()->getDB;
$db->Execute('UPDATE ' . cms_db_prefix() . 'module_nms_users SET confirmed = 1 where email = ?', array($email));
Cheers