Problem with JRequest::setVar and Email Verification

grafik 03 Apr, 2012
Hi
I use Chronoforms V3.2 and Joomla 1.5.23
I had a Problem that I try to solve, but I don't know how.

I had a form with a few fields and hidden fields.
and this code On Submit code - before sending email:
and I had this code too at the plugin OnSubmit Before Verification:
<?php
$email = JRequest::getVar('email', '', 'post');
$nachname = JRequest::getString('nachname', '', 'post');
$vorname = JRequest::getString('vorname', '', 'post');
$fullname = "$nachname $vorname";
JRequest::setVar('fullname', $fullname, 'post');
$firma = JRequest::getString('firma', '', 'post');

$raw_email  = rawurlencode($email);
$raw_nachname  = rawurlencode($nachname);
$raw_vorname  = rawurlencode($vorname);
$raw_name  = rawurlencode($fullname);
$raw_firma  = rawurlencode($firma);

$urlab = JURI::base()."index.php?option=com_acymailing&ctrl=sub&task=optout&hiddenlists=2&user[email]=$raw_email";
JRequest::setVar('abmelden', $urlab, 'post');
$url = JURI::base()."index.php?option=com_acymailing&ctrl=sub&task=optin&hiddenlists=2&user[email]=$raw_email&user[name]=$raw_name&user[vorname]=$raw_vorname&user[nachname]=$raw_nachname&user[firma]=$raw_firma";
JRequest::setVar('newsletter', $url, 'post');

?>

and this code On Submit code - after sending email:
<?php
$email = JRequest::getVar('email', '', 'post');
$nachname = JRequest::getString('nachname', '', 'post');
$vorname = JRequest::getString('vorname', '', 'post');
$fullname = "$nachname $vorname";
JRequest::setVar('fullname', $fullname , 'post');
$firma = JRequest::getString('firma', '', 'post');

$raw_email  = rawurlencode($email);
$raw_nachname  = rawurlencode($nachname);
$raw_vorname  = rawurlencode($vorname);
$raw_name  = rawurlencode($fullname);
$raw_firma  = rawurlencode($firma);

$urlab = JURI::base()."index.php?option=com_acymailing&ctrl=sub&task=optout&hiddenlists=2&user[email]=$raw_email";
JRequest::setVar('abmelden', $urlab, 'post');

@ini_set('allow_url_fopen', '1');
$ch = curl_init();

$url = JURI::base()."index.php?option=com_acymailing&ctrl=sub&task=optin&hiddenlists=2&user[email]=$raw_email&user[name]=$raw_name&user[vorname]=$raw_vorname&user[nachname]=$raw_nachname&user[firma]=$raw_firma";
JRequest::setVar('newsletter', $url, 'post');

curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
curl_close($ch);

?>


inside the Email I use {newsletter} , that works without any problem.

Saving Data/Emails order: Before Email

When I use all that Settings without Email Verification I had no Problem!

But when I Activate the Email Verification Plugin, i had Problems.
The Verification itself works, (Normal-Email is only send after click on verification link, inside the Verification Email)
but the Variables I try to set with JRequest::setVar were lost / not saved to the DB, the other fields are saved.
Result: Curl didn't work and at the Normal-Email that fields are missing.

Can someone help me?
I try my best change Plugin Order(Email Verification is the only active), Run Order, DB-Save Order. (nothing made it works)

Best Regards
grafik
sifon 03 Apr, 2012
anyone? any update? I have the same issue
grafik 03 Apr, 2012
when i change inside that file:
/components/com_chronocontact/plugins/cf_email_verification.php
this code
		//save the data
		$posted[$params->get('vflagfield')] = 0;
		if ( !empty($MyForm->formrow->autogenerated) ) {
			eval( "?>".$MyForm->formrow->autogenerated );
		}	
		//run the onsubmit before verification code
		if ( !empty($pluginrow->extra2) ) {
			eval( "?>".$pluginrow->extra2 );
		}	

to this code
		//run the onsubmit before verification code
		if ( !empty($pluginrow->extra2) ) {
			eval( "?>".$pluginrow->extra2 );
		}
		//save the data
		$posted[$params->get('vflagfield')] = 0;
		if ( !empty($MyForm->formrow->autogenerated) ) {
			eval( "?>".$MyForm->formrow->autogenerated );
		}	


It looks like save of the JRequest::setVar Field to DB works.
But the curl and the Normal-Email didnt work anymore after that change.

Hope that someone can help. I m going crazy, because i cant get it to work.
grafik 10 Apr, 2012

But the curl and the Normal-Email didnt work anymore after that change.


Correction:
both On Submit before e-mail code-fields works (before verification mail, and before normal mail)
but my curl didnt works inside the before e-mail.

Summary:
[list]
  • all php code inside the after verification Success and after normal e-mail didn't work. (Normal html works!)
  • It looks like that it doesn't matter if I use {} or getVar there.[/list]
    [list]
  • all php code inside On Submit before e-mail works
  • [/list]

    I can nearly do what I wish (send normal email with all fields inside, only after successful verification of the e-mail.)
    because of that, it is solved half for me. (still hope that it can solved full)

    Kind Regards
    grafik
    GreyHead 10 Apr, 2012
    Hi grafik,

    Sorry, it's a long time since I worked with anything like this in ChronoForms v3.

    I would probably hand code both the CURL and the email send and make them conditional on the verification haveing been checked.

    Bob
    This topic is locked and no more replies can be posted.