Hiding group_group field programmatically I am trying to hide the group_group (request membership) field for organic groups based on a radio button. Here is what I have done that doesn't work:

/**
 * Implements hook_form_alter().
 */
function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $menu = menu_get_item();
  $path = drupal_get_path_alias();

  $node = node_load($menu['page_arguments'][0]-&gt;nid);

  // field_show_group_group is radio button
  if($item['field_show_group_group'][LANGUAGE_NONE]['value'] === 0) {
    dsm("Just show the subscribe button - NOTHING to do.");
  }
  else {

    dsm("hide button");
    $instance = field_info_instance('node', 'group_group', 'community');
    $instance['widget']['settings']['og_hide'] = FALSE;
    $instance['settings']['behaviors']['og_widget']['access_override'] = FALSE;
    unset($instance['widget']['settings']['og_hide']);
    unset($instance['settings']['behaviors']['og_widget']['access_override']);
    $form['group_group']['#access'] = FALSE;
    $form['group_group'][LANGUAGE_NONE][0]['value']['#access'] = FALSE;
    unset($form['group_group']);
    unset($form['group_group']);
    $menu['page_arguments'][0]-&gt;group_group['und'][0]['value'] = 0;
    unset($menu['page_arguments'][0]);
    $item['group_group'][LANGUAGE_NONE][0]['value']['#access'] = FALSE;
    unset($item['group_group'][LANGUAGE_NONE][0]['value']['#access']);
    $node-&gt;group_group[LANGUAGE_NONE][0]['value']['#access'] = FALSE;


}

These are all possibilities I couldn't think of, which of course for some reason don't work. I searched the whole internet for this including drupal.org, drupal.stackexchange, google and stackoverflow. Can you help?
You should be able to hide the group_group field with the $form['group_group']['#access'] = FALSE; this is used by the Hide checkbox on the field settings page and this is how it works.

However, if you testing as an anonymous user maybe you have this issue: https://www.drupal.org/project/og/issues/2278003 there's a patch which fixes the access itself.