Skip to main content
deleted 590 characters in body
Source Link
Nishant
  • 2.3k
  • 3
  • 21
  • 37

hook_scheduler_api() accepts two parameters -

1. $node is the node object being processed
2. $action is either 'publish' or 'unpublish'

hook_scheduler_api()

<?php
/**
 * Implementation of hook_scheduler_api.
 *
 * @param $node
 *  The node object
 * @param $action
 *  The action being performed, either "publish" or "unpublish"
 */
function yourmodule_scheduler_api($node, $action) {
  if (some condition) {
    // parameters: drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) {
    drupal_mail('yourmodule', 'mail key', $user->mail, etc depending on your needs);
  }
}
?>

hook_mail()

<?php
/**
 * Implementation of hook_mail().
 *
 * Constructs an email.
 *
 * @param $key
 *   Unique key to indicate what message to build.
 * @param $message
 *   Reference to the message array being built.
 * @param $params
 *   Array of parameters to indicate what kind of text to include in the
 *   message body.
 *
 */
function yourmodule_mail($key, &$message, $params) {
  switch ($key) {
    case 'this-mail-key':
      $message['subject'] .= 'your subject';
      $message['body'][] = 'text';
      // etc ...
      break;
    // etc ...
}
?>

hook_scheduler_api() accepts two parameters -

1. $node is the node object being processed
2. $action is either 'publish' or 'unpublish'

hook_scheduler_api()

<?php
/**
 * Implementation of hook_scheduler_api.
 *
 * @param $node
 *  The node object
 * @param $action
 *  The action being performed, either "publish" or "unpublish"
 */
function yourmodule_scheduler_api($node, $action) {
  if (some condition) {
    // parameters: drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) {
    drupal_mail('yourmodule', 'mail key', $user->mail, etc depending on your needs);
  }
}
?>

hook_mail()

<?php
/**
 * Implementation of hook_mail().
 *
 * Constructs an email.
 *
 * @param $key
 *   Unique key to indicate what message to build.
 * @param $message
 *   Reference to the message array being built.
 * @param $params
 *   Array of parameters to indicate what kind of text to include in the
 *   message body.
 *
 */
function yourmodule_mail($key, &$message, $params) {
  switch ($key) {
    case 'this-mail-key':
      $message['subject'] .= 'your subject';
      $message['body'][] = 'text';
      // etc ...
      break;
    // etc ...
}
?>

hook_scheduler_api() accepts two parameters -

1. $node is the node object being processed
2. $action is either 'publish' or 'unpublish'

hook_scheduler_api()

<?php
    function yourmodule_scheduler_api($node, $action) {
  if (some condition) {
    // parameters: drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) {
    drupal_mail('yourmodule', 'mail key', $user->mail, etc depending on your needs);
  }
}
?>

hook_mail()

<?php

function yourmodule_mail($key, &$message, $params) {
  switch ($key) {
    case 'this-mail-key':
      $message['subject'] .= 'your subject';
      $message['body'][] = 'text';
      // etc ...
      break;
    // etc ...
}
?>
Source Link
Nishant
  • 2.3k
  • 3
  • 21
  • 37

hook_scheduler_api() accepts two parameters -

1. $node is the node object being processed
2. $action is either 'publish' or 'unpublish'

hook_scheduler_api()

<?php
/**
 * Implementation of hook_scheduler_api.
 *
 * @param $node
 *  The node object
 * @param $action
 *  The action being performed, either "publish" or "unpublish"
 */
function yourmodule_scheduler_api($node, $action) {
  if (some condition) {
    // parameters: drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) {
    drupal_mail('yourmodule', 'mail key', $user->mail, etc depending on your needs);
  }
}
?>

hook_mail()

<?php
/**
 * Implementation of hook_mail().
 *
 * Constructs an email.
 *
 * @param $key
 *   Unique key to indicate what message to build.
 * @param $message
 *   Reference to the message array being built.
 * @param $params
 *   Array of parameters to indicate what kind of text to include in the
 *   message body.
 *
 */
function yourmodule_mail($key, &$message, $params) {
  switch ($key) {
    case 'this-mail-key':
      $message['subject'] .= 'your subject';
      $message['body'][] = 'text';
      // etc ...
      break;
    // etc ...
}
?>