Active
Project:
Profile 2
Version:
7.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Jan 2013 at 06:24 UTC
Updated:
9 Feb 2013 at 10:47 UTC
Hi all,
I want to change the value of a profile2 field during a rules action with PHP. The name of the field is given by a variable called "fieldname", the field is an entity reference to an user:
$user_uid = $booking-user->uid;
$profile_name = 'profile_user';
$profile_entity = profile2_load_by_user($user_uid, $profile_name);
$field_change = $profile_entity->$fieldname;
$booking['und'][0]['target_id'] = 122;
profile2_save($profile_entity);
The profile is loaded but not saved... maybe profile2_save does not work within a rules action?
Best,
Tobias
Comments
Comment #1
VasilyKraev commentedSame problem. After creating new user, I got system message, user with change e-mail, but no changes in profile.
I use following rule:
Comment #2
HenrikBak commentedI have got the same issue with profile2_save(). I'm using it within a custom rule and It simply doesn't save the profile.
Comment #3
VasilyKraev commentedSeems as duplicate #1097684: Profile tokens are not available directly after adding/registering a user