You are here

function _views_xml_format_author in Views Datasource 6

Same name and namespace in other branches
  1. 7 views_xml.module \_views_xml_format_author()

Creates an author object to use in the headers of OPML and Atom documents

Parameters

$username:

Return value

unknown_type

2 calls to _views_xml_format_author()
template_preprocess_views_views_xml_style_atom in theme/views_views_xml_style.theme.inc
Template preprocess for the Atom format
template_preprocess_views_views_xml_style_opml in theme/views_views_xml_style.theme.inc

File

./views_xml.module, line 205
Module definition for views_xml

Code

function _views_xml_format_author($username) {
  $author = array();
  if (!$username) {
    $author["name"] = variable_get('anonymous', 'Anonymous');
    $author["email"] = variable_get('site_mail', 'none@none.info');
    return $author;
  }
  if (is_numeric($username)) {
    $user = user_load(array(
      'uid' => $username,
    ));
  }
  else {
    $user = user_load(array(
      'name' => $username,
    ));
  }
  if (!$user) {

    //$author["name"] = variable_get('anonymous', ('Anonymous'));

    //$author["name"] = variable_get('anonymous', ('Anonymous'));
    $author["name"] = $username;
    $author["email"] = variable_get('site_mail', 'none@none.info');
    return $author;
  }
  if (!module_exists("profile")) {
    $author["name"] = $username;
    $author["email"] = check_plain($user->mail);
    return $author;
  }
  else {
    profile_load_profile($user);
    $author["name"] = check_plain($user->profile_name ? $user->profile_name : $username);
    $author["email"] = check_plain($user->mail);
    if (user_access('access user profiles')) {
      $author['uri'] = url('user/' . $user->uid, array(
        'absolute' => TRUE,
      ));
    }
    return $author;
  }
}