From e4a0cbfd8b8d3f4ca736a8b844f5a04803ec5553 Mon Sep 17 00:00:00 2001 From: Tristan Olive Date: Wed, 27 Nov 2013 16:53:11 -0500 Subject: [PATCH] Reporting forum posts Added moderator notification rule for forum topics that are reported. This report will send an email to all users in the moderator role. (DBOINCP-44) --- .../boinc_standard.features.inc | 76 ++++++++++++++++++- .../boinc_standard.features.menu_links.inc | 2 +- .../boinc_standard/boinc_standard.info | 6 +- 3 files changed, 78 insertions(+), 6 deletions(-) diff --git a/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc b/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc index 299c11d5b1..9dc8daa1bc 100644 --- a/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc +++ b/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc @@ -31,10 +31,10 @@ function boinc_standard_flag_default_flags() { $flags['abuse_comment'] = array( 'content_type' => 'comment', 'title' => 'Comment Abuse', - 'global' => '0', + 'global' => FALSE, 'types' => array( - '0' => 'news', - '1' => 'forum', + '0' => 'forum', + '1' => 'news', ), 'flag_short' => 'Report', 'flag_long' => 'Report this content as offensive.', @@ -65,7 +65,7 @@ function boinc_standard_flag_default_flags() { $flags['abuse_node'] = array( 'content_type' => 'node', 'title' => 'Node Abuse', - 'global' => '0', + 'global' => FALSE, 'types' => array( '0' => 'profile', '1' => 'forum', @@ -191,3 +191,71 @@ function boinc_standard_node_info() { ); return $items; } + +/** + * Implementation of hook_rules_defaults(). + */ +function boinc_standard_rules_defaults() { + return array( + 'rules' => array( + 'rules_offensive_content_reported' => array( + '#type' => 'rule', + '#set' => 'event_flag_flagged_abuse_node', + '#label' => 'Offensive content reported', + '#active' => 1, + '#weight' => '0', + '#categories' => array( + '0' => 'moderator notification', + 'boinc_standard' => 'boinc_standard', + ), + '#status' => 'default', + '#conditions' => array(), + '#actions' => array( + '0' => array( + '#type' => 'action', + '#settings' => array( + 'recipients' => array( + '0' => 6, + ), + 'from' => '', + 'subject' => 'Report of offensive [node:type] content at [:global:site-name]', + 'message' => '[flagging_user:display-name] has reported the following [node:type] content as being offensive or inappropriate for the [:global:site-name] site: + +[:global:site-url][node:node-path] + +Total reports of this content: [node:flag-abuse-node-count]', + '#eval input' => array( + 'token_rules_input_evaluator' => array( + 'subject' => array( + '0' => 'node', + '1' => ':global', + ), + 'message' => array( + '0' => 'flagging_user', + '1' => 'node', + '2' => ':global', + ), + 'from' => array( + '0' => ':global', + ), + ), + ), + ), + '#name' => 'rules_action_mail_to_users_of_role', + '#info' => array( + 'label' => 'Send a mail to all users of a role', + 'module' => 'System', + 'eval input' => array( + '0' => 'subject', + '1' => 'message', + '2' => 'from', + ), + ), + '#weight' => 0, + ), + ), + '#version' => 6003, + ), + ), + ); +} diff --git a/drupal/sites/all/features/boinc_standard/boinc_standard.features.menu_links.inc b/drupal/sites/all/features/boinc_standard/boinc_standard.features.menu_links.inc index fb30f84bbe..6a771126d4 100644 --- a/drupal/sites/all/features/boinc_standard/boinc_standard.features.menu_links.inc +++ b/drupal/sites/all/features/boinc_standard/boinc_standard.features.menu_links.inc @@ -82,8 +82,8 @@ function boinc_standard_menu_default_menu_links() { ); // Translatables // Included for use with string extractors like potx. - t('Credentials'); t('BOINC'); + t('Credentials'); t('Dashboard'); t('Home'); diff --git a/drupal/sites/all/features/boinc_standard/boinc_standard.info b/drupal/sites/all/features/boinc_standard/boinc_standard.info index b8d92f8815..28dacd3ed7 100644 --- a/drupal/sites/all/features/boinc_standard/boinc_standard.info +++ b/drupal/sites/all/features/boinc_standard/boinc_standard.info @@ -8,8 +8,9 @@ dependencies[] = "boinccore" dependencies[] = "boincuser" dependencies[] = "boincwork" dependencies[] = "content" -dependencies[] = "drupal_queue" +dependencies[] = "ctools" dependencies[] = "diff" +dependencies[] = "drupal_queue" dependencies[] = "elysia_cron" dependencies[] = "exportables" dependencies[] = "features" @@ -33,7 +34,9 @@ dependencies[] = "php" dependencies[] = "quote" dependencies[] = "r4032login" dependencies[] = "role_delegation" +dependencies[] = "rules" dependencies[] = "strongarm" +dependencies[] = "system" dependencies[] = "tableofcontents" dependencies[] = "tabtamer" dependencies[] = "taxonomy" @@ -69,6 +72,7 @@ features[page_manager_pages][] = "account_dashboard" features[page_manager_pages][] = "boinc_user" features[page_manager_pages][] = "home" features[panels_mini][] = "dashboard_tables" +features[rules_categories][] = "moderator notification" features[user_permission][] = "Use PHP input for field settings (dangerous - grant with care)" features[user_permission][] = "access administration pages" features[user_permission][] = "access all views"