Does not work with Organic Groups 2.x reference fields.
This appears to be an OG problem. OG 2.x replaces the standard entity reference field system with its own custom og_membership table. It does not provide sufficient support for other modules to seamlessly integrate with this.
As a quick work around for a client, I did this in pfff.module at ll. 297 ff., for example:
drupal_session_regenerate();
if ( isset($fields_value['og_group_ref']) ) {
$tid=$fields_value['og_group_ref']['und'][0]['target_id'];
$result=db_query("INSERT INTO og_membership (type,etid,entity_type,gid,state,created,group_type,field_name,language)
VALUES ('og_membership_type_default', $user->uid, 'user',
$tid, '1', 1449887238, 'node', 'og_group_ref' , 'en') ");
}
user_save($user, $fields_value);
You'll likely want to replace the timestamp. Thanks.
Comments