diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index d9038980ae..e1d0921c1b 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -192,6 +192,11 @@ class ucp_profile extends module
case 'profile_info':
+ include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
+ $cp = new custom_profile();
+
+ $cp_data = $cp_error = array();
+
if ($submit)
{
$var_ary = array(
@@ -239,7 +244,10 @@ class ucp_profile extends module
extract($data);
unset($data);
- if (!sizeof($error))
+ // validate custom profile fields
+ $cp->submit_cp_field('profile', $cp_data, $cp_error);
+
+ if (!sizeof($error) && !sizeof($cp_error))
{
$sql_ary = array(
'user_icq' => $icq,
@@ -259,6 +267,19 @@ class ucp_profile extends module
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
+ // Update Custom Fields
+ $sql = 'UPDATE phpbb_profile_fields_data
+ SET ' . $db->sql_build_array('UPDATE', $cp_data) . '
+ WHERE user_id = ' . $user->data['user_id'];
+ $db->sql_query($sql);
+ if (!$db->sql_affectedrows())
+ {
+ $db->return_on_error = true;
+ $cp_data['user_id'] = (int) $user->data['user_id'];
+ $db->sql_query('INSERT INTO phpbb_profile_fields_data ' . $db->sql_build_array('INSERT', $cp_data));
+ $db->return_on_error = false;
+ }
+
meta_refresh(3, "ucp.$phpEx$SID&i=$id&mode=$mode");
$message = $user->lang['PROFILE_UPDATED'] . '
' . sprintf($user->lang['RETURN_UCP'], "", '');
trigger_error($message);
@@ -311,6 +332,11 @@ class ucp_profile extends module
'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,)
);
+
+ // Get additional profile fields and assign them to the template block var 'profile_fields'
+ $user->get_profile_fields($user->data['user_id']);
+ $cp->generate_profile_fields('profile', $user->get_iso_lang_id(), $cp_error);
+
break;
case 'signature':
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index d2087cd96a..5f51a67a8c 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -64,6 +64,11 @@ class ucp_register extends module
$this->display($user->lang['REGISTER'], 'ucp_agreement.html');
}
+ include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
+ $cp = new custom_profile();
+
+ $cp_data = $cp_error = array();
+
// Check and initialize some variables if needed
if ($submit)
{
@@ -103,6 +108,9 @@ class ucp_register extends module
extract($data);
unset($data);
+ // validate custom profile fields
+ $cp->submit_cp_field('register', $cp_data, $cp_error);
+
// Visual Confirmation handling
if ($config['enable_confirm'])
{
@@ -140,7 +148,7 @@ class ucp_register extends module
}
}
- if (!sizeof($error))
+ if (!sizeof($error) && !sizeof($cp_error))
{
$server_url = generate_board_url();
@@ -181,6 +189,11 @@ class ucp_register extends module
$user_id = $db->sql_nextid();
+ // Insert Custom Profile Fields
+ $cp_data['user_id'] = (int) $user_id;
+ $sql = 'INSERT INTO phpbb_profile_fields_data ' . $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data));
+ $db->sql_query($sql);
+
// Place into appropriate group, either REGISTERED(_COPPA) or INACTIVE(_COPPA) depending on config
$group_reg = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';
$group_inactive = ($coppa) ? 'INACTIVE_COPPA' : 'INACTIVE';
@@ -391,6 +404,12 @@ class ucp_register extends module
'S_UCP_ACTION' => "ucp.$phpEx$SID&mode=register")
);
+ //
+ $user->profile_fields = array();
+
+ // Generate profile fields -> Template Block Variable profile_fields
+ $cp->generate_profile_fields('register', $user->get_iso_lang_id(), $cp_error);
+
//
$this->display($user->lang['REGISTER'], 'ucp_register.html');
}