首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Drupal视图: node.type=abc和node.vocabulary_id=123节点的作者列表

Drupal视图: node.type=abc和node.vocabulary_id=123节点的作者列表
EN

Stack Overflow用户
提问于 2011-02-04 01:41:06
回答 1查看 790关注 0票数 0

在使用视图的drupal6中,我想要一些特定节点类型和分类term.id或vocabulary.id的作者(带有完整的概要字段)的(块)列表

汇总查询:

视图:用户类型

参数:术语ID /词汇ID

过滤器:节点类型abc的作者

字段:所有配置文件/内容配置文件字段

怎样才能实现这样的解决方案呢?

EN

回答 1

Stack Overflow用户

发布于 2011-03-31 02:28:29

我也有同样的问题。我发现,如果我按node.type =‘博客’过滤,并为我感兴趣的个人资料字段设置字段,我可以得到一个列表或作者,但会有重复的。将' distinct‘设置为Yes无济于事,因为它选择的是distinct节点,而不是distinct用户。

因此,我最终创建了一个自定义块来显示此信息,代码如下:

代码语言:javascript
复制
<?php
$block['subject'] = t('Bloggers');
    // Get a list of blog authors
    $result = db_query('SELECT DISTINCT u.uid, u.name FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = \'blog\'');
    $links = array();
    while ($blogger = db_fetch_object($result)) {
      $link = array();
      if (module_exists('profile')) {
        profile_load_profile($blogger);
      }
      if (!empty($blogger->profile_first_name) || !empty($blogger->profile_last_name)) {
        $link['title'] = $blogger->profile_first_name . (empty($blogger->profile_first_name) ? '' : ' ') . $blogger->profile_last_name;
      }
      else {
        $link['title'] = $blogger->name;
      }
      $link['href'] = 'blog/' . $blogger->uid;
      $links[] = $link;
    }
    $block['content'] = theme('links', $links, array('class' => 'flat-links'));
?>

希望这能有所帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4889591

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档