We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49637
    • 10 Posts
    Hello together,

    I have the following case:

    I have a simple contact form with formit where the user can insert name, email, a message and so on. I would like to make an automated registration via the register snippet (I think this is the right one for this?) when this form is sent.

     
    [[!FormIt? 
    	&hooks=`email,FormItAutoResponder,redirect`
    	&emailTpl=`sentemailTpl`
    	&emailSubject=`My Subject`
    	&emailFrom=`[email protected]`
    	&emailFromName=`Sender`
    	&emailTo=`[email protected]`
    	&fiarTpl=`autoresponderTpl`
    	&fiarSubject=`Thank You`
    	&fiarToField=`email`
    	&fiarFrom=`[email protected]`
    	&fiarFromName=`My Company`
    	&redirectTo=`15`
    ]]


    How can I insert the register snippet with my values "name" and "email" to create a user? I would like to send the login data with the autoresponder email.

    I have called the snippet as hook before, but this didn't work.

    Does someone has created something like this before?

    Greets

    Steffen
      • 17301
      • 932 Posts
      I've done something similar and how I approached it was like this:

      Instead of using FormIt I used the Register snippet with a posthook that sends out an email. You can use the posthook to send the contact form input fields to you and the user will get the registration link in the email.
      [[!Register?
        &submitVar=`loginRegisterBtn`
        &activationResourceId=`***`
        &activationEmailTpl=`myActivationEmailTpl`
        &activationEmailSubject=`Thank you for Registering!`
        &submittedResourceId=`***`
        &placeholderPrefix=`reg.`
        &usernameField=`email`
        &validate=`email:required,
        password: required`
        &postHooks=`hookComEmail`
      ]]
      


      hookComEmail

      <?php
      $headers .= "From: ***<**@**********.uk>\n"; // Set the email sender
      $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; //
       
      $message = 'Success!
       
      <p>We have captured a new registration over at the *** website.</p>
      
      <p>Their name is '.$hook->getValue('firstname').' '.$hook->getValue('lastname').'</strong>, 
      <strong>'.$hook->getValue('email').'</strong></p>
      
      Best of luck!';
       
      $to = "**@**********.uk"; // Set where this email is going to
      $subject = "New Registration";
       
       
       if (mail($to, $subject, $message, $headers)) {
         echo("<p>Message successfully sent!</p>");
        } else {
         echo("<p>Message delivery failed...</p>");
        }
      [ed. note: lkfranklin last edited this post 9 years, 3 months ago.]
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 49637
        • 10 Posts
        Hi LK,

        thanks for your reply. Is it not possible to make it the other way around? Because I have a lot of hooks in my formit call and I work with formit retriever (multipage form). I don't want to change everything.

          • 17301
          • 932 Posts
          Yes there will be a way but I've not done it myself and it may require a custom hook snippet to work. It should be pretty easy to code up but will need to know your password field and username field to do so.

            ■ email: [email protected] | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.