Tag Archives: sr_feuser_register

MySQL signed unix_timestamp per convertire date precedenti al 1-1-1970

su TYPO3 le date sono salvate come unix_timestamp, un numero intero positivo se successive al 1-1-1970, negativo se precendenti.

MySQL ha una funzione UNIX_TIMESTAMP che restituisce zero per le date precedenti al 1-1-1970, quindi è sufficiente dichiarare una funzione SIGNED_UNIX_TIMESTAMP e usarla:

DELIMITER |
CREATE FUNCTION SIGNED_UNIX_TIMESTAMP (d DATETIME)
RETURNS BIGINT
 DETERMINISTIC
  BEGIN
    DECLARE tz VARCHAR(100);
    DECLARE ts BIGINT;
    SET tz = @@time_zone;
    SET time_zone = '+00:00';
    SELECT DATEDIFF(d, FROM_UNIXTIME(0)) * 86400 +
    TIME_TO_SEC(
      TIMEDIFF(
        d,
        DATE_ADD(MAKEDATE(YEAR(d), DAYOFYEAR(d)), INTERVAL 0 HOUR)
      )
    ) INTO ts;
    SET time_zone = tz;
    return ts;
  END|
DELIMITER ;

Poi usata ad esempio così:

UPDATE fe_users SET
`date_of_birth` = SIGNED_UNIX_TIMESTAMP('1955-10-21'),
WHERE 1

Nota: il campo date_of_birth è aggiunto dall’estensione sr_feuser_register

Add custom fields in sr_feuser_register w/out TCA_INPUT marker error

In recent version of sr_feuser_register adding custom fields with classic procedure give a TCA_INPUT marker error like ###TCA_INPUT_MYCUSTOMFIELD### in front end.

There is a commented line 61 in class.tx_srfeuserregister_tca.php  

// $TSFE->includeTCA(); takes too much memory

Of course you can uncomment that line, but it takes too much memory, so instead use the complete input code:

<input id=”tx-srfeuserregister-pi1-myNewFieldName” type=”text” size=”40” maxlength=”50” title=”###TOOLTIP_MYNEWFIELDNAME###” name=”FE[fe_users][myNewFieldName]” class=”tx-srfeuserregister-pi1-text” />

Like written in the wiki wiki.typo3.org…sr_feuser_register

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

}