1

I don't want the OG audience selection to appear on a custom content type I have created for groups. I'm only providing the link to create the custom content within a group so the group they are in is pre-selected and it makes no sense to display it. I can't believe there is not a OG option to turn this off so how can I accomplish this?

2 Answers 2

2

You can set #access to FALSE to hide elements like this:

/**
* Implements hook_form_alter()
**/

function yourModule_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'yourFormId':
      // We should remove the group check box from users, Its always going to be
      // checked for project content type.
      $form['group_group']['#access'] = FALSE;
      $form['group_access']['#access'] = FALSE;
      break;
    }
}

Above I removed the check box that says "group" and group audience.

0

Look at the FAPI docs and hook_form_alter on your content type. For the appropriate widget try setting the widgets #access key to FALSE. If it's not horribly coupled to OG's interworkings that should work (and assuming its default value is ok). I would recommend doing this for everyone who is not the uid of admin.

1
  • As a Drupal newbie that's way out of my comfort zone. I do have a development background and looked at the FAPI docs but have no idea how to get started. I have done some more looking around and discovered the Contextual Administration OG module which looks like it would also work and not require any coding but looks pretty complicated to setup.
    – John81
    Commented Mar 29, 2012 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.