Code: Select all
$dims = mysqli_query($db,"SELECT pf_tankdim FROM phpbb_profile_fields_data WHERE user_id=".$UserID);
$dim = mysqli_fetch_assoc($dims);
$TankDim = $dim['pf_tankdim'];
$TankDim = preg_replace("/\D+/", ':',$TankDim); // Remplace les non-digits consécutifs par :
$Dim3 = array_pad(explode(":",$TankDim),3,"0");
$Vol = $Dim3[0] * $Dim3[1] * $Dim[2] / 1000;
$upd = mysqli_query($db,"UPDATE phpbb_profile_fields_data SET `pf_autovol`='".$Vol."' WHERE user_id=".$UserID);
core.ucp_profile_info_modify_sql_ary
event which is run just before the profile information is saved to the database. You can update the relevant profile field during that event before it's saved to the database.ucp_profile.php
on line 400.Code: Select all
/**
* Modify profile data in UCP before submitting to the database
*
* @event core.ucp_profile_info_modify_sql_ary
* @var array cp_data Array with the user custom profile fields data
* @var array data Array with user profile data
* @var array sql_ary user options data we update
* @since 3.1.4-RC1
*/
$vars = array('cp_data', 'data', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_modify_sql_ary', compact($vars)));
var_dump
to see the contents of the variables.exit;
after dumping the array. e.g.Code: Select all
var_dump($cp_data);
// Your code
var_dump($cp_data);
exit;
var_dump($cp_data);
gives for instance$cp_data["pf_autovol"] = $Vol;
$vars = array('cp_data', 'data', 'sql_ary');
add
Code: Select all
$TankDim = preg_replace("/\D+/", ':',$cp_data['pf_tankdim']); // Replace consecutive non-digits by ":"
$Dim = array_pad(explode(":",$TankDim),3,"0");
$TankVol = round((int)$Dim[0]*(int)$Dim[1]*(int)$Dim[2]/1000);
($TankVol == 0) ? $TankVol = "?" : $TankVol = $TankVol." litres"; // (Condition) ? true : false
$cp_data["pf_autovol"] = $TankVol;
$vars = array('cp_data', 'data', 'sql_ary');
/phpbb/profilefields/manager.php
. Check out the build_insert_sql_array()
function in that file (lines 535 - 568).Code: Select all
/**
* Modify profile data in UCP before submitting to the database
*
* @event core.ucp_profile_info_modify_sql_ary
* @var array cp_data Array with the user custom profile fields data
* @var array data Array with user profile data
* @var array sql_ary user options data we update
* @since 3.1.4-RC1
*/
$vars = array('cp_data', 'data', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_modify_sql_ary', compact($vars)));
No not danieltj: viewtopic.php?p=16021867#p16021867