You are here

function tweet_feed_set_message in Tweet Feed 7.3

Same name and namespace in other branches
  1. 7.2 tweet_feed.module \tweet_feed_set_message()

Custom Set Message Function

If drush exists, then we are running in drush and need to output our errors there. We do not want drush errors going ot the screen. Will also only send messages if the user uid is 1.

5 calls to tweet_feed_set_message()
drush_tweet_feed_tf_import_tweets in ./tweet_feed.drush.inc
Import Tweets
tweet_feed_process_feed in ./tweet_feed.module
Iterate through the feeds and import
tweet_feed_process_taxonomy in ./tweet_feed.module
Process hashtags and user mentions in tweets
tweet_feed_process_tweets in ./tweet_feed.module
Process each tweet
tweet_feed_pull_data_from_feed in ./tweet_feed.module
Get Twitter Data

File

./tweet_feed.module, line 698

Code

function tweet_feed_set_message($message, $type = 'status', $web_interface = FALSE) {

  // If we're coming from the web interface, then we do not want to do anything here
  if ($web_interface != FALSE) {
    return;
  }

  // Get our global user object to check for user id 1 on drupal set message
  global $user;
  if (function_exists('drush_print')) {
    if ($type != 'error' && $type != 'warning' && $type != 'fatal') {
      drush_log($message, 'ok');
    }
    else {
      if ($type == 'fatal') {
        drush_set_error($message);
      }
      else {
        drush_log($message, $type);
      }
    }
  }
  else {
    if ($type != 'drush') {
      $type = $type == 'fatal' ? 'error' : $type;
      $type = $type == 'ok' ? 'status' : $type;
      if ($user->uid == 1) {
        drupal_set_message(check_plain($message), $type);
      }
    }
  }
}