Skip to content

Commit

Permalink
Patch OG module to fix permission conflict issue and add membership p…
Browse files Browse the repository at this point in the history
…ending request message.
  • Loading branch information
revagomes committed Jul 30, 2020
1 parent e8aa961 commit bea5e6b
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 2 deletions.
5 changes: 5 additions & 0 deletions profiles/pece/modules/contrib/og/PATCHES.txt
Original file line number Diff line number Diff line change
@@ -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).
4 changes: 2 additions & 2 deletions profiles/pece/modules/contrib/og/og.module
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From c612699560440fda3bc7ea1043266ac84aa1a99e Mon Sep 17 00:00:00 2001
From: Renato Vasconcellos <revagomes@gmail.com>
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

17 changes: 17 additions & 0 deletions profiles/pece/modules/contrib/og/og_ui/og_ui.module
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down
40 changes: 40 additions & 0 deletions profiles/pece/patches/og_ui-membership-pending-request-msg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From c612699560440fda3bc7ea1043266ac84aa1a99e Mon Sep 17 00:00:00 2001
From: Renato Vasconcellos <revagomes@gmail.com>
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

0 comments on commit bea5e6b

Please sign in to comment.