MODIFY CFDEF_STANDARD.PHP
Find this piece of code:
-----------------------------------------------------
$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_EMAIL ] = array (
'#display_possible_values' => TRUE,
'#display_valid_regexp' => TRUE,
'#display_length_min' => TRUE,
'#display_length_max' => TRUE,
'#display_default_value' => TRUE,
'#function_return_distinct_values' => null,
'#function_value_to_database' => null,
'#function_database_to_value' => null,
'#function_print_input' => 'cfdef_input_textbox',
'#function_string_value' => 'cfdef_prepare_email_value',
'#function_string_value_for_email' => 'cfdef_prepare_email_value_for_email',
);
-----------------------------------------------------
and change this line:
-----------------------------------------------------
'#function_print_input' => 'cfdef_input_textbox',
-----------------------------------------------------
to this:
-----------------------------------------------------
'#function_print_input' => 'cfdef_input_email',
-----------------------------------------------------
in the same CFDEF_STANDARD.PHP, add these code at the end:
-----------------------------------------------------
function cfdef_input_email($p_field_def, $t_custom_field_value) {
# By XFMM
# Split the value into address and domain
$t_domains_list = custom_field_prepare_possible_values( $p_field_def['possible_values'] );
$t_address_part = $t_custom_field_value ;
$t_domain_part = '' ;
if( $t_domains_list <> '' ){
$t_position_at = strpos($t_custom_field_value,'@');
if( $t_position_at > 0 ){
$t_address_part = substr($t_custom_field_value,0,$t_position_at);
$t_domain_part = trim(substr($t_custom_field_value,$t_position_at+1));
}
}
# Let's begin with a single input field.
echo '';
# Now, let's add a list with commonly used domains, taken from the "possible values" argument.
$t_domains_list = custom_field_prepare_possible_values( $p_field_def['possible_values'] );
if( $t_domains_list <> '' ){
echo ' @ ';
$t_values = explode( '|', $t_domains_list);
$t_list_size = 0; # Treat this as an ENUM, not a list.
echo '';
}
}
-----------------------------------------------------
Now, modify GPC_API.PHP
Find this function:
-----------------------------------------------------
function gpc_get_custom_field( $p_var_name, $p_custom_field_type, $p_default = null ) {
-----------------------------------------------------
And just before the 'default' Statement of the 'switch' structure, add the following:
-----------------------------------------------------
case CUSTOM_FIELD_TYPE_EMAIL:
# XFMM: Mix address + domain.
$t_value = gpc_get_string( $p_var_name, $p_default );
if( strpos($t_value,'@') == 0 && $t_value<>''){
$t_var_name_domain = $p_var_name.'_domain';
$t_value .= '@' . gpc_get_string ($t_var_name_domain,'') ;
}
return $t_value;
break;
-------------------------------------------------
Finally, go to manage your custom field, and add some domains in the "possible values" field, to see your solution working!.
-------------------------------------------------