Hi All
using module rules custom php im trying to update a profile field

$date = strtotime(+1 year);

#this is my code and i know it is very wrong :)
$edit2 = serialize(array($date));
$edit = array( 'profile_member_expiry' => $edit2 );
profile_save_profile($edit, $account, "Personal information");

mycode results
s:37:"a:1:{i:0;s:19:"2014-05-20 10:10:01";}";

what it should look like
a:3:{s:3:"day";s:2:"19";s:5:"month";s:1:"5";s:4:"year";s:4:"2014";}

also profile_member_expiry gets updated in mysql but all other "Personal information" fields are deleted
im guessing profile_save_profile is incorrect

many thanks in advance
steve

Comments

canzi’s picture

$day = date('j');
$month = date('n');
$year = date('Y', strtotime('+1 year'));
$convert = array('day' => $day, 'month' => $month, 'year' => $year);
$sldata = serialize($convert);
$sql = "insert into profile_values (fid, uid, value) values(13, $account, '%s')";

db_query("DELETE FROM profile_values WHERE fid = 13 AND uid = $account");
db_query($sql, $sldata);