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) |
Jump to:
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
Moving, this should be a rather simple change. Maybe send a patch.
#2
mandatory group module should implement this if desired.
#3
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
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
no patch, no review.
#6
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
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
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