You are here

function _notifications_content_node_username in Notifications 7

Same name and namespace in other branches
  1. 6.4 notifications_content/notifications_content.module \_notifications_content_node_username()

Get username from node (and add it to the node object)

File

notifications_content/notifications_content.module, line 655
Subscriptions to content events

Code

function _notifications_content_node_username($node) {

  // If the node comes from a page query, it may have an author name, otherwise we set it
  if (empty($node->name)) {
    if ($author = notifications_load_user($node->uid)) {
      $node->name = $author->name;
    }
    else {
      $node->name = t('Unknown');
    }
  }
  return $node->name;
}