Is there any way to send out a notification when there are terms waiting in limbo? Right now I have Rules & Actions set up to notify an admin when a new Recipe is submitted on my site, and I'd like to also let them know that there's a taxonomy term waiting to be approved.

Comments

Zen’s picture

Component: Miscellaneous » Code
Category: support » feature
itsnotme’s picture

I would love to have such a feature too.

rogeriodec’s picture

Some code on unitag.module (between asterisks marks):

function unitag_nodeapi(&$node, $op, $teaser, $page) {
  // We are not going to bother with the delete op as the suggestion for a new
  // term will possibly still be valid. The same applies to node updates - old
  // suggestions will continue to be retained.
  if ($op == 'insert' || $op == 'update') {
    if (isset($node->unitag_suggestions)) {
      $suggestion_list = array();
      foreach ($node->unitag_suggestions as $vid => $suggestions) {
        foreach ($suggestions as $suggestion) {
          unitag_suggestion_save($node->nid, $vid, $suggestion);
          $suggestion_list[] = $suggestion;
        }
      }
      if (!empty($suggestion_list)) {
        drupal_set_message(t('The following tags have been added to the moderation queue: %tags', array('%tags' => implode(', ', $suggestion_list))));
// **************** SEND E-MAIL *************		
		$message = array(
			'headers' => array(
				'From' =>  'from@example.com',
				'MIME-Version' => '1.0',
				'Content-Type' => 'text/html;charset=utf-8',
			),
		);
		$message['to'] = 'to@example.com';
		$message['subject'] = 'Tags waiting for approval';
		$message['body'] = '<html><head></head><body><p>There are some terms waiting for approval:<br><br>'. implode(', ', $suggestion_list) . '</p></body></html>';
		drupal_mail_send($message);
//********************************************
      }
    }