0

I have a custom content type "course" and it has an entity reference to username. ( the username is basically an instructor who is suppose to teach the course )

I have created a field "Course Completed" in course content type and admin changes it to "completed" manually. The content type also has a filed "Number of hours"

What i need is, when the node is marked as completed, the "Number of hours" is taken from node and added to user account. ( i can create a field using profile2 and name it as "user credit hours")

How would i do this? is there any module which will work similar to what is needed ?

thanks

2
  • You could do that easily with rules IMO
    – Kojo
    Dec 27, 2015 at 16:57
  • yes also it needed some code in custom module.
    – brainHax
    Dec 29, 2015 at 14:07

1 Answer 1

0

i managed to do it with rules and adding some action code in a custom module.

enter image description here

After adding a condition, i had a make a custom action and then i was able to add that action in to the created rule.

You can send value to your custom action and then load user and update its field.

$user = user_load($user_trainer_id);
$obj = entity_metadata_wrapper('user', $user);
$obj->field_earned_credit_hours = $new_custom_value;
$obj->save();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.