Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there,
It's my objective to allow the user to select just one group while creating a node within a group. I've written my own module and implemented hook_form_alter(). So I've changed $form['og_nodeapi']['visible']['og_groups']['#multiple'] to FALSE. As soon as I preview or submit a group form I get the error
warning: array_filter() [function.array-filter]: The first argument should be an array in /sites/all/modules/og/og.module on line 1748.
I totally understand what's going on: the POST value of $form['og_nodeapi']['visible']['og_groups'] has to be an array. How can I achieve my goal? Any suggestions?
Comments
Comment #1
bjacob CreditAttribution: bjacob commentedThis function is very important for me. Is there anyone who could help me, please?
Comment #2
ZoeN CreditAttribution: ZoeN commentedSeconded - I need this too (instead of the checkboxes in the Groups section, we need a single-select dropdown box).
Comment #3
geek-merlinI want to understand this too ;-)
Is there a hook where we can jump in and choose which groups are allowed and which preselected?
I think i remember that og_forum needed some patching of og.module to limit the froups available.
Comment #4
bjacob CreditAttribution: bjacob commentedI've found a solution. First of all I've created a new module. There I'm using hook form_alter.
Maybe the name of the validation function is not the best and the error message needs some more attention. But it works for me.
If you want to get rid of the checkboxes you can also achieve it with the help of hook form_alter().
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedComment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.