Join two fields - member registration
Hi,
I've add custom fields to member registration.
1. Phone Operator (select)
Now I've made one more custom field where I would like to join Phone operator and Phone number when the form is submitted. Results would be: In database the Phone Operator and Phone Number should be in that new table field.
How could be this accomplished?
Thanks for any help!
Re: Join two fields - member registration
You could use the createNewUser hook, which triggers on registration.
The hook needs to be registered in a config file
Code:
$GLOBALS['TL_HOOKS']['createNewUser'][] = array('ClassName', 'functionName');
and the Class added somewhere - so you might need to make a little module to do this.
ClassName.php
Code:
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
class ClassName extends Backend
{
public function functionName($intId, $arrData)
{
$operatorAndPhone = $arrData['operator'] .'-'. $arrData['phone'];
$this->Database->prepare("UPDATE tl_member SET newfieldName=? WHERE id=?")
->limit(1)
->execute($operatorAndPhone,$intId);
}
}
?>
Re: Join two fields - member registration
Thank you ramjet, for your excelent tips!