Thanks very much for the amazing module that og is.

I appreciate how complex the audience fieldset visibility is.
This is not a new problem and is still present in og-6.x-2.x-dev.

In case where audience is required and user is member of more than one group.
When creating new content the Groups audience fieldset is collapsed.
If user does not see this and saves the post they are warned that Audience is required and the fieldset is shown not collapsed. So it is handled gracefully.

When post is subsequently edited the audience fieldset is shown not collapsed.

It would be good if the audience fieldset is also not collapsed when new content is being created to save the user going through the warning if they don't see to select an audience.

Looking at the code in og.module around line 1920 shows:

  if (module_exists('content')) {
    $form['og_nodeapi']['#type'] = 'fieldset';
    $form['og_nodeapi']['#title'] = t('Groups');
    $form['og_nodeapi']['#group'] = 'additional_settings';
    $form['og_nodeapi']['#collapsible'] = TRUE;
    $form['og_nodeapi']['#collapsed'] = empty($groups);
    $form['og_nodeapi']['#weight'] = content_extra_field_weight($form['#node']->type, 'og_nodeapi');

There is a lot of complex logic that precedes this but I it looks like the line with empty($groups) suggests that if no group has yet been selected the fieldset will be collapsed. I am wondering where it would be best to add "OR audience is required" to display the fieldset for new content.

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

izmeez’s picture

Title: og audience fieldset collapsed on new content » og do not collapse required audience on create new content
Status: Active » Needs review
FileSize
553 bytes

Realized the solution may be quite simple. I have added a patch for review and changed the title for clarity.

izmeez’s picture

Here is a better patch that also preserves the original behaviour when audience is not required; create new content will collapse audience fieldset but on editing content will not collapse if an audience has been selected.

izmeez’s picture

Just a note. I deliberately did not use $required because even though admin users may not be required to declare an audience it is helpful for them to see the audience options if those are generally required of users.

izmeez’s picture

+bump

I wonder if someone might review this simple patch to see if it merits commit.
It is a simple issue that came from users and relates to the UX. Makes life a little easier for users :-)

Thanks,

Izzy

izmeez’s picture

+bump

I'm still wondering if someone might review this. It is a simple patch that makes for consistency and better user experience. Currently, if a user is editing a post the audience is not collapsed but if they are creating a new post the audience is collapsed and more easily missed by the user. This patch makes the audience expanded on creating new post the same as it is on editing an existing post.

bessone’s picture

+1

Grayside’s picture

Status: Needs review » Fixed

http://drupalcode.org/project/og.git/commit/9f707c9

I like it. I had some very minor reservations, but as I looked at the surrounding function and found some of the most convoluted code I've seen in months, there was nothing that could clean it up without a generalized refactor.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sano’s picture

Is this supposed to be available in the 6.x-2.4+13-dev build? I do have that build installed, but the groups fieldset block is still shown collapsed when creating new content.

Thank you

Sano

sano’s picture

Well, it looks like choosing Required in the Audience required field on the Organic groups configuration page makes the block expanded when creating content.