From 9cb6f3dd356592cc286903f5bb26711bef79e9bc Mon Sep 17 00:00:00 2001 From: Shawn Kwang Date: Wed, 27 Mar 2019 10:00:52 -0500 Subject: [PATCH] Druapl: Add additional admin notifications to Feature teams. --- .../all/features/teams/teams.features.inc | 110 ++++++++++++++++++ drupal/sites/all/features/teams/teams.info | 4 + 2 files changed, 114 insertions(+) diff --git a/drupal/sites/all/features/teams/teams.features.inc b/drupal/sites/all/features/teams/teams.features.inc index b198bf41fc..e4a9f770ca 100644 --- a/drupal/sites/all/features/teams/teams.features.inc +++ b/drupal/sites/all/features/teams/teams.features.inc @@ -33,6 +33,116 @@ function teams_node_info() { return $items; } +/** + * Implementation of hook_rules_defaults(). + */ +function teams_rules_defaults() { + return array( + 'rules' => array( + 'rules_notify_admins_about_error_creating_a_boinc_team' => array( + '#type' => 'rule', + '#set' => 'event_boincteam_create_team_error', + '#label' => 'Notify admins about error creating a BOINC team', + '#active' => 1, + '#weight' => '0', + '#categories' => array( + '0' => 'boinc_team', + 'teams' => 'teams', + ), + '#status' => 'default', + '#conditions' => array(), + '#actions' => array( + '0' => array( + '#type' => 'action', + '#settings' => array( + 'from' => '', + 'subject' => 'Error creating new team', + 'message' => '[user:display-name] attempted to create team [team_name:string], but an error was returned. See function \'boincteam_create_form_submit\'. BOINC function \'make_team\' did not return a valid boinc_team object.', + '#eval input' => array( + 'token_rules_input_evaluator' => array( + 'subject' => array( + '0' => ':global', + ), + 'message' => array( + '0' => 'team_name', + '1' => 'user', + '2' => ':global', + ), + 'from' => array( + '0' => ':global', + ), + ), + ), + ), + '#name' => 'boinccore_rules_action_mail_to_admins', + '#info' => array( + 'label' => 'Notify admins via email', + 'module' => 'BOINC core', + 'eval input' => array( + '0' => 'subject', + '1' => 'message', + '2' => 'from', + ), + ), + '#weight' => 0.0, + ), + ), + '#version' => 6003, + ), + 'rules_notify_admins_about_error_creating_a_boinc_team_no_pathauto' => array( + '#type' => 'rule', + '#set' => 'event_boincteam_create_team_nopathauto_error', + '#label' => 'Notify admins about error creating a BOINC team no pathauto', + '#active' => 1, + '#weight' => '0', + '#categories' => array( + '0' => 'boinc_team', + 'teams' => 'teams', + ), + '#status' => 'default', + '#conditions' => array(), + '#actions' => array( + '0' => array( + '#type' => 'action', + '#settings' => array( + 'from' => '', + 'subject' => 'Error creating BOINC team - no pathauo module', + 'message' => '[user:display-name] attempted to create team [team_name:string], but no pathauto module detected. See function \'boincteam_create_form_submit\'.', + '#eval input' => array( + 'token_rules_input_evaluator' => array( + 'subject' => array( + '0' => ':global', + ), + 'message' => array( + '0' => 'team_name', + '1' => 'user', + '2' => ':global', + ), + 'from' => array( + '0' => ':global', + ), + ), + ), + ), + '#name' => 'boinccore_rules_action_mail_to_admins', + '#info' => array( + 'label' => 'Notify admins via email', + 'module' => 'BOINC core', + 'eval input' => array( + '0' => 'subject', + '1' => 'message', + '2' => 'from', + ), + ), + '#weight' => 0.0, + ), + ), + '#version' => 6003, + ), + ), + ); +} + /** * Implementation of hook_views_api(). */ diff --git a/drupal/sites/all/features/teams/teams.info b/drupal/sites/all/features/teams/teams.info index 9e0ac608a3..977f41179c 100644 --- a/drupal/sites/all/features/teams/teams.info +++ b/drupal/sites/all/features/teams/teams.info @@ -10,7 +10,10 @@ dependencies[] = "features" dependencies[] = "page_manager" dependencies[] = "panels" dependencies[] = "panels_mini" +dependencies[] = "rules" +dependencies[] = "rules_admin" dependencies[] = "strongarm" +dependencies[] = "token" dependencies[] = "upload" dependencies[] = "views" dependencies[] = "views_content" @@ -21,6 +24,7 @@ features[node][] = "team" features[page_manager_pages][] = "create_team" features[page_manager_pages][] = "teams_landing" features[page_manager_pages][] = "view_team" +features[rules_categories][] = "boinc_team" features[user_permission][] = "create boincteam" features[user_permission][] = "join boincteam" features[variable][] = "comment_anonymous_team"