Add twice email to sr_feuser_register TYPO3 extension

Do you want to add a twice email field to sr_feuser_register like the password one?

It’s simple following these 4 steps 

  1. Read the documentation to add personal fields
  2. Add custom “email_again” field in the HTML template
  3. Add custom label in TypoScript
  4. Add eval rule in TypoScript

First: I assume you done this step before, if not read this

Second: add “email_again” field in the sr_feuser_register html template

<!— ###SUB_INCLUDED_FIELD_email### —>

<dt>

<label for=”tx-srfeuserregister-pi1-email”>###LABEL_EMAIL### ###REQUIRED_EMAIL###</label>

</dt>

<dd>

<!— ###SUB_ERROR_FIELD_email### —>

<p class=”tx-srfeuserregister-pi1-error”>###EVAL_ERROR_FIELD_email###</p>

<!— ###SUB_ERROR_FIELD_email### —>

<!— ###SUB_REQUIRED_FIELD_email### —>

<p class=”tx-srfeuserregister-pi1-error”>###MISSING_EMAIL###</p>

<!— ###SUB_REQUIRED_FIELD_email### —>

<input id=”tx-srfeuserregister-pi1-email” type=”text” class=”tx-srfeuserregister-pi1-text full” size=”40” maxlength=”255” title=”###TOOLTIP_EMAIL###” name=”###NAME_EMAIL###” />

</dd>

<dt>

<label for=”tx-srfeuserregister-pi1-email_again” class=”tx-srfeuserregister-pi1-text full”>###LABEL_EMAIL_AGAIN###</label>

</dt>

<dd>

<input id=”tx-srfeuserregister-pi1-email_again” type=”text” class=”tx-srfeuserregister-pi1-text full” size=”40” maxlength=”255” title=”” name=”FE[fe_users][email_again]” />

</dd>

<!— ###SUB_INCLUDED_FIELD_email### —>

Third: add custom labels in TypoScript:

plugin.tx_srfeuserregister_pi1.extraLabels (

    email_again,

    tooltip_email_again,

    missing_email_again,

    evalErrors_twice_email_again

)

plugin.tx_srfeuserregister_pi1._LOCAL_LANG.default {

       email_again = please repeat your email address

       tooltip_email_again = 

       missing_email_again = missing email

       evalErrors_twice_email_again = emails must be the same!

}

plugin.tx_srfeuserregister_pi1._LOCAL_LANG.it {

      email_again = ripeti la tua email 

      tooltip_email_again =  

      missing_email_again = manca la seconda email

      evalErrors_twice_email_again = devono essere uguali!

}

Fourth: add the right rule in TypoScript

plugin.tx_srfeuserregister_pi1 {

      # the new rule applied to email field, not email_again field.
      create.evalValues.email = required,email,twice,atMost[255]

}

Hints: to change the template file use

plugin.tx_srfeuserregister_pi1 {

# the new template file

       templateFile = fileadmin/template/tx_srfeuserregister_pi1_css_tmpl_01.html

}

One thought on “Add twice email to sr_feuser_register TYPO3 extension”

Leave a Reply