Last active
September 20, 2016 07:51
-
-
Save bangpound/c5c462a6da067b44b88e3d142b37818c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/og_email_blast.info b/og_email_blast.info | |
old mode 100755 | |
new mode 100644 | |
index 75bf2d8..e1b7d68 | |
--- a/og_email_blast.info | |
+++ b/og_email_blast.info | |
@@ -5,3 +5,10 @@ package = Organic groups | |
dependencies[] = og_ui | |
files[] = og_email_blast.module | |
files[] = og_email_blast.admin.inc | |
+ | |
+; Information added by drupal.org packaging script on 2012-04-13 | |
+version = "7.x-2.x-dev" | |
+core = "7.x" | |
+project = "og_email_blast" | |
+datestamp = "1334277191" | |
+ | |
diff --git a/og_email_blast.module b/og_email_blast.module | |
old mode 100755 | |
new mode 100644 | |
index 002ed48..79ed08c | |
--- a/og_email_blast.module | |
+++ b/og_email_blast.module | |
@@ -44,12 +44,51 @@ function og_email_blast_menu() { | |
/** | |
* Implements hook_og_ui_get_group_admin(). | |
*/ | |
-function og_email_blast_og_ui_get_group_admin($gid) { | |
+function og_email_blast_og_ui_get_group_admin($group_type, $gid) { | |
$items = array(); | |
- $items['email_people'] = array( | |
- 'title' => t('E-mail people'), | |
- 'description' => t('E-mail group members.'), | |
- 'href' => "admin/email", | |
- ); | |
+ if (og_user_access($group_type, $gid, 'email_blast')) { | |
+ $items['email_people'] = array( | |
+ 'title' => t('E-mail people'), | |
+ 'description' => t('E-mail group members.'), | |
+ 'href' => "admin/email", | |
+ ); | |
+ } | |
return $items; | |
} | |
+ | |
+/** | |
+ * Check if entity is a group, and user has permission - Access. | |
+ */ | |
+function og_email_blast_user_access_group($perm, $group_type, $gid) { | |
+ $group = entity_load_single($group_type, $gid); | |
+ if (!$group || !og_is_group($group_type, $group)) { | |
+ return FALSE; | |
+ } | |
+ | |
+ // Extract the group's bundle. | |
+ list(, , $bundle) = entity_extract_ids($group_type, $group); | |
+ // Verify the bundle has roles | |
+ if (!og_roles($group_type, $bundle, $gid)) { | |
+ return FALSE; | |
+ } | |
+ | |
+ $entity_info = entity_get_info($group_type); | |
+ if (!$group_type || !$entity_info) { | |
+ // Not a valid entity type. | |
+ return FALSE; | |
+ } | |
+ return og_is_group($group_type, $gid) && og_user_access($group_type, $gid, $perm); | |
+} | |
+ | |
+/** | |
+ * Implement hook_og_permission(). | |
+ */ | |
+function og_email_blast_og_permission() { | |
+ $items = array(); | |
+ $items['email_blast'] = array( | |
+ 'title' => t('E-mail group members'), | |
+ 'description' => t('Users may blast other users...'), | |
+ 'default role' => array(OG_ADMINISTRATOR_ROLE), | |
+ ); | |
+ return $items; | |
+} | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment