Forums

Subscription via URL

mariokrupik 04 May, 2008
HI,

I would like to use my existing form, to subscribe Users to my Newsletter. Acajoom gives me the offer to subscribe my users via an Url.

So what I would like to do:

I inserted a checkbox for newsletter, when this one is marked, chronoforms should redirect the User to this URL:

http://www.mysite.com/index.php?option=com_acajoom&act=subscribe&name= Mario&email=asa@asa.com&listid=1&receive_html=1&redirectlink=http://www.mysite.com/thankyoupage

The Red marked Items "name" and "email" should be pasted from the just before entered Form.

How could I do this?

Also would it be possible to store this data in the Database?
I mean only if the Checkbox is marked, it should store the Informations in the Database.

thanks,
mario<br><br>Post edited by: mariokrupik, at: 2008/05/04 14:30
GreyHead 05 May, 2008
Hi mario,

Here's a piece of code I wrote to do a direct sign-up to AcaJoom.
<?php

// construct a single name for AcaJoom
$vorname  = JRequest::getVar( 'vorname', '', 'post', 'string', '' );
$nachname = JRequest::getVar( 'nachname', '', 'post', 'string', '' );
$email = JRequest::getVar( 'email', '', 'post', 'string', '' );
$name = urlencode($vorname." ".$nachname);
// JRequest::«»setVar( 'name', $vorname." ".$nachname );

// Build a redirect url to pass the info to Acajoom
$redirect_url = "index.php?option=com_acajoom&Itemid=&subscribed[1]=1&sub_list_id[1]=1&acc_level[1]=29&receive_html=1&act=subscribe&listname=1";
$redirect_url .= "&name=$name&email=$email";
$rows[0]->redirecturl = $redirect_url;
?>
This code went in the OnSubmit after email' box. 'I used hidden fields in my form to make sure that all the AcaJoom variables are in the $_POST array, though you could probably add them here.

To have this only happen when the checkbox is checked you just wrap this in a if () clause; and the same with the autogenerated code.

Bob
mimhof 07 Jun, 2008
Hi...that code is for 1.5 right? My 1.0 gives me an jrequest error.

How would you accomplish the same in 1.0
GreyHead 07 Jun, 2008
Hi mimhof,

Yes that's for Joomla 1.5, in 1.0 youi can replace
JRequest::getVar( 'vorname', '', 'post', 'string', '' ); 
with
$_POST['vorname']
Bob
This topic is locked and no more replies can be posted.