Hi,

As far as I can read more group audience fields can be used in on content type with 7.x-2.x-dev (probably with the stable version too - please, correct me if I'm wrong). It'd be great because I have to set up a group for supereditors (who can edit content in every group). So I have group audience field which is prepopulated from the URL and an other one which has a default value through this code:

function MYMODULE_form_alter(&$form, $form_state, $form_id) {

  if (in_array($form_id, array('thesis_node_form', 'review_node_form'))) {
    if (!empty($form['field_og_group_ref_admin'])) {
      if (empty($form['field_og_group_ref_admin'][LANGUAGE_NONE][0]['default']['#default_value'])) {
        $form['field_og_group_ref_admin'][LANGUAGE_NONE][0]['default']['#default_value'][0] = 10; // Group ID of supereditors
         $form['field_og_group_ref_admin'][LANGUAGE_NONE]['#attributes']['disabled'] = TRUE;
      }
    }
  }
}

In the edit form both fields have their proper value but when I save the node the first field losts its value (coming from the URL). Actually it doesn't matter how the second group audience field is set, the first reference field losts the value in saving nonetheless. And the issue may related to user permissions somehow becouse admin user (overriding all access restrictions) can save the node with the two OG-reference fields, other users can't.

Please help me to find out whether it's a bug or I made a mistake in configuration.

Comments

StG created an issue.

ttronslien’s picture

You say in the edit form the fields have their proper value? Does that mean you have a node that is already created and all you are doing is updating the node? If so, you likely have a permission issue. OG uses hook_node_access which modules may implement if they want to have a say in whether or not a given user has access to perform a given operation on a node. Node access can't check if user has create permissions using og_user_access(), as there is no group context, however it can on node update/delete.

Without knowing much of your context I suggest you

1) Test if this issue also happens on node create - make observations
2) make sure that the user that you are trying to save as has permission to edit in group #10 and then edit a node - make observations. I assume you don't want the students to have access to the supervisors group (10) so obviously this is not a permanent solution, but at least you know what you have to work around.