What is the recommended method for programmatically editing or inserting values into the field_data_* tables? I'm using Drupal 7.7

I'm working on a module to programmatically add users to an Organic Group.  I'm using og_group() and og_role_grant(), but the user is not given full access without also having their group_audience field set correctly.  So, my end goal is really to do just that.  I cannot find any OG functions that will perform that function, so I'm asking, generically, if there is any Drupal-approved method of writing data into that table.

I've tried using field_bundle_settings(), but I can't get that to work, and I'm pretty sure it won't ever work.

my code is below:

&lt;?php

$settings = array(
    'group_audience' =&gt; array(
    'entity_id' =&gt; $user-&gt;uid,
    'group_audience_gid' =&gt; $gid,
    'group_audience_state' =&gt; '1',
  ),
);
field_bundle_settings("user", "user", $settings);


thanks
If you want to create users belonging to a group (able to publish content under the group, see group content), og_group() should do the trick; I'd check your implementation and make sure it's ok before going too far astray. I'm doing the exact same thing with the following code and it's correctly inserting the group_audience values into the field_data_group_audience table.

og_group($group_id, array('entity' =&gt; $account));


However, if you're totally stuck and want to try another route, you can always manually insert the data through db_insert().