default audience - mandatory group

simillibus - August 11, 2006 - 08:48
Project:Organic Groups Mandatory Group
Version:HEAD
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Using OG with the Mandatory group module, I'm wondering if it might be possible to have the Mandatory Group checked by default on content creation pages? (so that content is directed to the mandatory group by default, rather than to Public?)

(is this better asked on the Mandatory Group page? - I'll wait rather than cross-post)

thanks,
will taylor

#1

Gerhard Killesreiter - August 11, 2006 - 08:55
Project:Organic groups» Organic Groups Mandatory Group
Version:4.7.x-1.x-dev» HEAD
Component:og.module» Code
Category:support request» feature request

Moving, this should be a rather simple change. Maybe send a patch.

#2

moshe weitzman - August 11, 2006 - 12:27

mandatory group module should implement this if desired.

#3

pwolanin - August 11, 2006 - 16:13

hmmm, sound like a job for hook_form_alter. I can see how this would be useful, and I'd review a patch. However, I'm not going to to try to implement this myself right now.

#4

mwu - August 31, 2006 - 19:34

I am interested in this. Ideally, I'd want to be able to specify the default group to be applied only to some content types. I'll send you a private message to see how long much time it would take to write this

#5

pwolanin - January 5, 2007 - 02:17
Status:active» closed

no patch, no review.

#6

inforeto - January 31, 2007 - 23:45
Status:closed» postponed (maintainer needs more info)

I'd rather reopen this issue than open a new one identical feature request.

Can someone point me to the necessary functions to read the mandatory og group?
The result would be passed to hook_form_alter as suggested above.

#7

inforeto - February 1, 2007 - 01:29

  if ($form_id == 'node-form' && isset($form['og_nodeapi'])) {
    $item_value = $form['og_nodeapi']['visible']['og_groups_visible']['#value'];

    $group_count = count($item_value);
    if ($mandatory_group = variable_get('og_mandatory_group', 0)) {
      if ($mandatory_group_in_form = in_array($mandatory_group, $item_value)) {

        foreach($item_value as $item){
          if($item == $mandatory_group){

            /* pending 1: here remove the group from $item_value */

          }
        }

        /* pending 2: here add back the group through a checked checkbox. */

        $form['og_nodeapi']['visible']['og_groups_visible']['#value'] = $item_value;
      }
    }
  }

This code would go into og_mandatory_group_form_alter.
I just followed the example in that same hook.

I do not know how to use forms api to add the checked box to $form['og_nodeapi']['visible']['og_groups_visible'].

Also, to force it to stay checked it'd need to be a disabled checkbox or a hidden input tag.
Or perhaps this should be done after the form is submitted, but another hook must be used.

#8

pknag - February 7, 2007 - 04:18

Just trying to see if a solution has been found for this issue. I would be very interested in this feature as I am facing the same problem with not having a default audience. Even better would be to have a mandatory group and a separate default group for postings only.

Thanks

 
 

Drupal is a registered trademark of Dries Buytaert.