Subscribe user to group programatically

theimitrovsky
Hello, I want to add a new user to a group using og_group function, but i dont know how to add additional parameters to the $value. In this case, i need for the new user to have a specific role, and to have user membership expire. Can you guys help me? Much appreciated, Goran P.S. Here is a snippet of the code i use: $account = user_load($uid); $values = array( 'entity_type' => 'user', 'entity' => $account, 'state' => OG_STATE_ACTIVE, 'roles' => "Learner", ); if ($membership = og_group('node', $gid, $values)) { entity_save('og_membership', $membership); return $membership; }