Skip to content

Instantly share code, notes, and snippets.

@alnutile
Created August 13, 2013 17:09
Show Gist options
  • Save alnutile/6223340 to your computer and use it in GitHub Desktop.
Save alnutile/6223340 to your computer and use it in GitHub Desktop.
Og access patch. Just place in the og_access folder and run patch -p0 < patch_name
--- og_access.module 2013-08-13 12:00:30.000000000 -0500
+++ og_access.module.monkey_patched 2013-08-13 12:05:38.000000000 -0500
@@ -167,10 +167,11 @@
// Add public checkbox to node edit form.
function og_access_alter_nongroup_form(&$form, $form_state, $node) {
- global $user;
-
+ global $user;
// If user has no subscriptions, don't bother with Public checkbox - it's meaningless.
- if (og_is_group_post_type($node->type) && !empty($form['og_nodeapi']['visible'])) {
+ if (og_is_group_post_type($node->type)) {
+ // @todo temp fix below
+ // && !empty($form['og_nodeapi']['visible'])) {
// get the visibility for normal users
$vis = variable_get('og_visibility', 0);
@@ -207,7 +208,7 @@
}
switch ($vis) {
- case OG_VISIBLE_BOTH:
+ case OG_VISIBLE_BOTH:
$form['og_nodeapi']['og_public'] = array('#type' => 'value', '#value' => 1);
break;
case OG_VISIBLE_GROUPONLY:
@@ -243,7 +244,8 @@
* Implementation of hook_form_alter().
*/
function og_access_form_alter(&$form, &$form_state, $form_id) {
- if (isset($form['#node']) && $form_id == $form['#node']->type .'_node_form') {
+
+if (isset($form['#node']) && $form_id == $form['#node']->type .'_node_form') {
// This way, our js gets added even if form is cached.
$form['#pre_render'][] = 'og_access_add_js';
$node = $form['#node'];
@alnutile
Copy link
Author

The only line that really matter here is 12 'if (og_is_group_post_type($node->type)) {'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment