Help to integrate the file?

t.stewen 05 Jan, 2009
Hi,

Can you give me a guide how to inegrate the file in my Newsletter-Form?

Please =)
GreyHead 05 Jan, 2009
Hi t.stewen,

>> I've moved this post into a new thread as it didn't seem to link to the prevoius one.

What file? into what form? Please tell us some more.

If you want a file upload field then you can add this in the Form HTML?

Bob
t.stewen 05 Jan, 2009
Ok,

I want to explain what i want...

I need a Newsletter-Form but the Form is only there to collect the Data from the Users so i dont need a Newsletter-Comp.
For an legally Newsletter I need a "double-opt-in" (you send the Form and get an email with a "activation"-Link like "klick here to validate your email-adress").

So i need a unique generated link for each user in the email and save the klick in the database.

I hobe you understand me and thanks for help =)
GreyHead 05 Jan, 2009
Hi t.stewen,

Yes you can do this. Create your form with the email field, a hidden field with the name 'token' and no value, and a submit button; create a database table and save it. In the OnSubmit before box generate a random token. Create an email and include a link in it using the random token and include the &task=send option.

Either use the same form with some PHP to recognise whether this is a validation or a form submission OR use a second form to cature the reply and update the database.

That's a very sketchy reply - is it enough?

Bob
t.stewen 05 Jan, 2009
Tanks...

I need a little bit more information about the email-part... (my php knowledge is enough)...

Step by Step reply:

1) create Form width hidden field
2) befor submit: update hidden field width php (insert unique code)
3) Create E-Mail -> Here i need more input😉
4) Create a Form width check the code and update the Database (when correct, send the Data per mail) -> here i need some more input too

My questins:
How can i update the E-Mail with the generated Code?
How can i get the Userdata from the first form (name, street etc) for step 4 to send the whole data per mail?

Tanks Tobias
GreyHead 05 Jan, 2009
Hi t.stewen,

How can i update the E-Mail with the generated Code?

In the form HTM include a hidden field
<input type='hidden' name='code' value='' />
In the Email template you can set the value of the code
<?php
$code = // some code to create a unique token
JRequest::setVar('code', $code, 'post');
$url  = "http://mydomain.com/index.php?option=com_chronocontacr&chronoformname=my_form&task=send";
$url .= "&code=$code";
?>
// Some html for your email
<p>Please click this link to validate <a href="<?php echo $url; ?>">Click Here</a></p>


I don't understand your question about street addresses - do you want to use snail-mail? You cna add extra fields to the form if you do.

Bob
t.stewen 05 Jan, 2009
Tanks Bob you're great =)

I don't know that i can use php in the mail-templates... ok so this is easy =)

i explain the second part:
in the first form you fill out the name, the firstname, the email and some checkboxes (interessts categorys).
now you can't use these userdata because double-opt-in left. so i dont want these userdata per mail.
now you get the link width the code and click on it (another form with an code field). On submit the double-opt-in is correct and i can send the newsletter to this user.
On this position i want an mail width the data from the first form (name, the firstname, the email and some checkboxes).

I hope you understand me =)
GreyHead 05 Jan, 2009
Hi t.stewen,

OK. I'd probably do this with one form. Have the form gather all the info and save it to the database table.

In the OnSubmit after use a PHP 'if' to give you two different routes.
<?php
$code = JRequest('code', '', 'get);
if ($code) {
    // this is the result of a validation email
    // search in the database to get this users info
    // create an email and send it
    // disable the standard email
} else {
    // this is an initial form submission
    // send the standard email
}
?>


Bob
t.stewen 06 Jan, 2009
Ok...

finaly question... how to disable the standard mail?😉

Tanks Tobias
Max_admin 06 Jan, 2009
Hi Tanks,

Disable it in the Email properties box!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
t.stewen 06 Jan, 2009
Ah..

so i must send the mail with php... ok =)
(first i think that i can send the mail over chronoforms and can disable it there only for the second part)

great work =)
big thx
GreyHead 06 Jan, 2009
Hi t.stewen,

Well that's the official answer, the unofficial one is
<?php
$rows[0]->emailresults = 0;
?>
You could probably switch between emails too - but I haven't worked out how to do that yet.

Bob
t.stewen 07 Jan, 2009
Hi,

i have a problem with the Db-Connect for the code:

  $db = JFactory::getDBO();  

  while($unique == false){
    $password = passwortgenerator(20);
    $query = "SELECT code FROM #__chronoforms_Newsletter WHERE code='".$password."'";
    $db::query($query);
    if($db::getNumRows() < 1){
      $unique = true;
    }
  }  

  $link = "http://www.mywebspace.de/test.php?code=".$password;  


widthout the DBconnection it works fine...
please help me =)

(the code is in the "On Submit code - before sending email:" field)
GreyHead 07 Jan, 2009
Hi t.stewen,

A few small changes
      $db =& JFactory::getDBO(); 

      while($unique == false) {
        $password = passwortgenerator(20);
        $query = "SELECT code FROM #__chronoforms_Newsletter WHERE code='".$password."';";
        $db->query($query);
        if ( $db->getNumRows() < 1){
          $unique = true;
        }
      } 

      $link = "http://www.mywebspace.de/test.php?code=".$password;  

Bob
t.stewen 09 Jan, 2009
Hi,

i have another problem now..

when i send an mail php i have problems with charakters like öäüÖÄÜ€?
When they come from Crono, all works fine..?

Why?

EDIT:
i have stil problems with the databasepart... when i delete this part, the system send me an email but not when it is inserted?! Why?
Max_admin 09 Jan, 2009
this line :
 $password = passwortgenerator(20);
is the function passwortgenerator is defined somewhere ? the function name is correct ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
t.stewen 12 Jan, 2009
Yes... but i found the error!

but i don't know why?! now i put the code (copy and past) in the "after sending email"-field and it works with this small changed code

      $password = "";
      
      while($password == ""){
        $temp_password = passwortgenerator(20);
        $db = JFactory::getDBO();  
        $db->setQuery("SELECT code FROM jos_chronoforms_Newsletter WHERE code='".$temp_password."';");    

        if(count($db->loadObjectList()) < 1){
          $password = $temp_password;
        }
      }
      JRequest::setVar('code', $password);


but not in the "before sending email"-field...

The problem with the charakters is still there
GreyHead 12 Jan, 2009
Hi t.stewen,

Code in the OnSubmit Before box is *not* run unless 'Email the Results?' is set to YES in the General Tab.

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