This repository has been archived by the owner on May 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
send e-mail for authentication functionality added
- Loading branch information
1 parent
0a82427
commit 569cbe9
Showing
5 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,42 @@ | |
|
||
|
||
|
||
|
||
|
||
/* | ||
This will configure the e-mail that will be sent to all the members of the website | ||
*/ | ||
|
||
function course_creation_mail($key, &$message, $params){ | ||
$language = $message["language"]; | ||
switch($key){ | ||
|
||
case "key": | ||
$message["subject"] = t("PantaRhei Announcement: ".$params["title"]); | ||
$message['body'][] = | ||
'Dear '.$params["name"].', | ||
|
||
'.$params["content"].' | ||
|
||
|
||
You can comment '.$params['link'].'. | ||
|
||
|
||
PantaRhei Admin | ||
' | ||
|
||
|
||
; | ||
break; | ||
|
||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
/* | ||
**Implements hook_node_presave() . | ||
**/ | ||
|
@@ -603,8 +639,58 @@ function course_creation_node_presave($node){ | |
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
/* This will send notifications to all members | ||
*/ | ||
|
||
|
||
function course_creation_node_insert($node){ | ||
if($node->type == "announcement_entry" && $node->field_send_email['und']['0']['value'] == 1) { | ||
|
||
$query = db_select('users', 'u'); | ||
$query->fields('u', array('name')); | ||
$result = $query->execute(); | ||
$members = array(); | ||
while($record = $result->fetchAssoc()) { | ||
$members[] = $record['name']; | ||
|
||
} | ||
|
||
foreach ($members AS $member) { | ||
$user = user_load_by_name($member); | ||
|
||
|
||
|
||
|
||
|
||
if ($user) | ||
if($user->status == "1"){ | ||
|
||
$to = $user->mail; | ||
|
||
if($user->field_full_name) | ||
$params["name"] = $user->field_full_name["und"]["0"]["value"]; | ||
else | ||
$params["name"] = $user->name; | ||
$params["link"] = l(t("here"),"node/".$node->nid); | ||
$params["title"] = $node->title; | ||
$params["content"] = $node->body["und"]["0"]["value"]; | ||
$email_from = "[email protected]"; | ||
|
||
$sent = drupal_mail("course_creation", "key", $to, language_default(), $params, $email_from, TRUE); | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
|
||
} | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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