blog_page_user

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/blog/blog.pages.inc, строка 11

Версии
5
blog_page_user($uid)
6
blog_page_user($account)

Коллбэк меню. Показывает страницу Друпал с последними записями в блоге данного пользователя.

Код

<?php
function blog_page_user($account) {
  global $user;

  drupal_set_title($title = t("@name's blog", array('@name' => $account->name)));

  $items = array();

  if (($account->uid == $user->uid) && user_access('create blog entries')) {
    $items[] = l(t('Post new blog entry.'), "node/add/blog");
  }
  else if ($account->uid == $user->uid) {
    $items[] = t('You are not allowed to post a new blog entry.');
  }

  $output = theme('item_list', $items);

  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
  $has_posts = FALSE;
  
  while ($node = db_fetch_object($result)) {
    $output .= node_view(node_load($node->nid), 1);
    $has_posts = TRUE;
  }
  
  if ($has_posts) {
    $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
  }
  else {
    if ($account->uid == $user->uid) {
      drupal_set_message(t('You have not created any blog entries.'));
    }
    else {
      drupal_set_message(t('!author has not created any blog entries.', array('!author' => theme('username', $account))));
    }
  }
  drupal_add_feed(url('blog/'. $account->uid .'/feed'), t('RSS - !title', array('!title' => $title)));

  return $output;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему