Hi,
Attached is a small fix to my previous patch for group-type settings: http://drupal.org/node/340950
The settings would get lost when updating content types. The attached fixes that.
Ryan
| Comment | File | Size | Author |
|---|---|---|---|
| og_read_only.patch | 1.5 KB | ryan_courtnage |
Comments
Comment #1
Rustan commentedI'm trying this (against -dev, with .module changed to the linked file above):
------------------------
$ patch < og_read_only.patch
patching file og_read_only.install
patching file og_read_only.module
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file og_read_only.module.rej
$ cat og_read_only.module.rej
*************** function og_read_only_form_node_type_for
*** 202,209 ****
*/
function og_read_only_form_node_type_submit($form, &$form_state) {
- $save[$form_state['values']['type']] = array_filter($form_state['values']['og_read_only_master_types']);
- variable_set('og_read_only_master_types', $save);
}
/**
--- 202,210 ----
*/
function og_read_only_form_node_type_submit($form, &$form_state) {
+ $master_types = variable_get('og_read_only_master_types', array());
+ $master_types[$form_state['values']['type']] = array_filter($form_state['values']['og_read_only_master_types']);
+ variable_set('og_read_only_master_types', $master_types);
}
/**
-----------
Hint?
Comment #2
ryan_courtnage commentedThe version # in the issue description is wrong. The patch applies to the DRUPAL-6--2 branch:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og_read_onl...
Comment #3
Rustan commentedThanks, I got it to work. I'm new to Drupal and learning. I do not understand what it is the patch is for, so I cannot test if it works. What type of updating removed the settings?
Comment #4
Rustan commentedI have two custom content types that can be posted in groups, info and photos. I want one to be read-only (info).
Both are listed on the OG settings for both types. I can change settings for both, and no settings disappear. However, on the photos type, the checkbox for info is not marked when it is changed in the info page.
Also, info content can be posted by non-admins for groups. When I mark photos as read-only, they too can still be posted.
When making info and photo types read-only for a single group, it works fine.
Comment #5
ryan_courtnage commented@rustan. If you set the og_read_only settings for content-type, and then submit the content-type settings form for a different content-type, the og_read_only settings for the original would be lost. This patch fixes it.
Sorry, but i don't really follow what you are describing in comment #4
Comment #6
Rustan commentedOk, wouldn't it make more sense to only show the read-only setting for the content type currently being edited, than the settings for all content types?
What I tried to describe in #4 is that the basic module works for me, but I cannot get your patch to work.
Comment #7
ryan_courtnage commentedI keep re-reading #4 but still can't get my head around it :). Perhaps you can rephrase it?
The admin interface would make more sense if, in the content-type admin, the "Read-only content types (for Group nodes)" settings only appeared if "Organic groups usage" was set to "Group node". The settings are only useful for group nodes. They do nothing for content types that are OG "Standard group posts".
However, the only way we could do this is with javascript, as the content-types admin allows the OG usage to be changed at any time. Javascript is not my strong-suit, so I opted to just be verbose in the field description.
Comment #8
Rustan commentedGreat, now I finally understand! (I think...)
I was supposing the interface worked in a completely different way, and was not careful to read the text.
So, at the content type settings page for a content marked as group node, that is where the settings for group posts have an effect, nowhere else. This works for me now, also when another content type has been changed! Thanks, extremely useful for me. Sorry for the trouble.
Comment #9
yrocq commentedFixed in branch DRUPAL-6--2. Thanks !