From bea5e6bf48ed08a981306fd90e54448eaca233ed Mon Sep 17 00:00:00 2001 From: Renato Vasconcellos Date: Thu, 30 Jul 2020 20:04:03 -0300 Subject: [PATCH] Patch OG module to fix permission conflict issue and add membership pending request message. --- profiles/pece/modules/contrib/og/PATCHES.txt | 5 +++ profiles/pece/modules/contrib/og/og.module | 4 +- ...og_ui-membership-pending-request-msg.patch | 40 +++++++++++++++++++ .../modules/contrib/og/og_ui/og_ui.module | 17 ++++++++ ...og_ui-membership-pending-request-msg.patch | 40 +++++++++++++++++++ 5 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 profiles/pece/modules/contrib/og/PATCHES.txt create mode 100644 profiles/pece/modules/contrib/og/og_ui-membership-pending-request-msg.patch create mode 100644 profiles/pece/patches/og_ui-membership-pending-request-msg.patch diff --git a/profiles/pece/modules/contrib/og/PATCHES.txt b/profiles/pece/modules/contrib/og/PATCHES.txt new file mode 100644 index 000000000..f4340b831 --- /dev/null +++ b/profiles/pece/modules/contrib/og/PATCHES.txt @@ -0,0 +1,5 @@ +The following patches have been applied to this project: +- https://www.drupal.org/files/issues/2020-07-15/og-ignore-grants-permissions-3159453-2.patch +- og_ui-membership-pending-request-msg.patch + +This file was automatically generated by Drush Make (http://drupal.org/project/drush). diff --git a/profiles/pece/modules/contrib/og/og.module b/profiles/pece/modules/contrib/og/og.module index 2338d344c..fd1b274c4 100755 --- a/profiles/pece/modules/contrib/og/og.module +++ b/profiles/pece/modules/contrib/og/og.module @@ -757,9 +757,9 @@ function og_form_group_reference_validate($form, &$form_state) { if ($entity_type == 'node') { $node = empty($id) ? $bundle : $entity; - // We call node_node_access() directly as we just want to check the + // We call node_access() directly as we just want to check the // permissions using user_acces(). - if (node_node_access($node, $op, $account)) { + if (node_access($op, $node, $account)) { // User has site-wide permissions to create or edit the node. return; } diff --git a/profiles/pece/modules/contrib/og/og_ui-membership-pending-request-msg.patch b/profiles/pece/modules/contrib/og/og_ui-membership-pending-request-msg.patch new file mode 100644 index 000000000..89cf77ef0 --- /dev/null +++ b/profiles/pece/modules/contrib/og/og_ui-membership-pending-request-msg.patch @@ -0,0 +1,40 @@ +From c612699560440fda3bc7ea1043266ac84aa1a99e Mon Sep 17 00:00:00 2001 +From: Renato Vasconcellos +Date: Thu, 16 Jul 2020 01:54:43 -0300 +Subject: [PATCH] Add pending message on Group page after subscription action. + +--- + og_ui/og_ui.module | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/og_ui/og_ui.module b/og_ui/og_ui.module +index 879480c7..3e3d8b86 100644 +--- a/og_ui/og_ui.module ++++ b/og_ui/og_ui.module +@@ -611,6 +611,23 @@ function og_ui_field_formatter_view($entity_type, $entity, $field, $instance, $l + $links['href'] = "group/$entity_type/$id/unsubscribe"; + $links['class'] = 'group unsubscribe'; + } ++ if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_PENDING))) { ++ $element[] = array( ++ '#type' => 'html_tag', ++ '#tag' => 'span', ++ '#attributes' => array('title' => t('Membership Pending'), 'class' => 'group pending-status'), ++ '#value' => t('Membership Pending'), ++ ); ++ ++ return $element; ++ } ++ if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_ACTIVE))) { ++ if (og_user_access($entity_type, $id, 'unsubscribe', $account)) { ++ $links['title'] = t('Unsubscribe from group'); ++ $links['href'] = "group/$entity_type/$id/unsubscribe"; ++ $links['class'] = 'group unsubscribe'; ++ } ++ } + } + else { + if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_BLOCKED))) { +-- +2.17.1 + diff --git a/profiles/pece/modules/contrib/og/og_ui/og_ui.module b/profiles/pece/modules/contrib/og/og_ui/og_ui.module index 879480c7e..3e3d8b866 100644 --- a/profiles/pece/modules/contrib/og/og_ui/og_ui.module +++ b/profiles/pece/modules/contrib/og/og_ui/og_ui.module @@ -611,6 +611,23 @@ function og_ui_field_formatter_view($entity_type, $entity, $field, $instance, $l $links['href'] = "group/$entity_type/$id/unsubscribe"; $links['class'] = 'group unsubscribe'; } + if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_PENDING))) { + $element[] = array( + '#type' => 'html_tag', + '#tag' => 'span', + '#attributes' => array('title' => t('Membership Pending'), 'class' => 'group pending-status'), + '#value' => t('Membership Pending'), + ); + + return $element; + } + if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_ACTIVE))) { + if (og_user_access($entity_type, $id, 'unsubscribe', $account)) { + $links['title'] = t('Unsubscribe from group'); + $links['href'] = "group/$entity_type/$id/unsubscribe"; + $links['class'] = 'group unsubscribe'; + } + } } else { if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_BLOCKED))) { diff --git a/profiles/pece/patches/og_ui-membership-pending-request-msg.patch b/profiles/pece/patches/og_ui-membership-pending-request-msg.patch new file mode 100644 index 000000000..89cf77ef0 --- /dev/null +++ b/profiles/pece/patches/og_ui-membership-pending-request-msg.patch @@ -0,0 +1,40 @@ +From c612699560440fda3bc7ea1043266ac84aa1a99e Mon Sep 17 00:00:00 2001 +From: Renato Vasconcellos +Date: Thu, 16 Jul 2020 01:54:43 -0300 +Subject: [PATCH] Add pending message on Group page after subscription action. + +--- + og_ui/og_ui.module | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/og_ui/og_ui.module b/og_ui/og_ui.module +index 879480c7..3e3d8b86 100644 +--- a/og_ui/og_ui.module ++++ b/og_ui/og_ui.module +@@ -611,6 +611,23 @@ function og_ui_field_formatter_view($entity_type, $entity, $field, $instance, $l + $links['href'] = "group/$entity_type/$id/unsubscribe"; + $links['class'] = 'group unsubscribe'; + } ++ if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_PENDING))) { ++ $element[] = array( ++ '#type' => 'html_tag', ++ '#tag' => 'span', ++ '#attributes' => array('title' => t('Membership Pending'), 'class' => 'group pending-status'), ++ '#value' => t('Membership Pending'), ++ ); ++ ++ return $element; ++ } ++ if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_ACTIVE))) { ++ if (og_user_access($entity_type, $id, 'unsubscribe', $account)) { ++ $links['title'] = t('Unsubscribe from group'); ++ $links['href'] = "group/$entity_type/$id/unsubscribe"; ++ $links['class'] = 'group unsubscribe'; ++ } ++ } + } + else { + if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_BLOCKED))) { +-- +2.17.1 +