在使用视图的drupal6中,我想要一些特定节点类型和分类term.id或vocabulary.id的作者(带有完整的概要字段)的(块)列表
汇总查询:
视图:用户类型
参数:术语ID /词汇ID
过滤器:节点类型abc的作者
字段:所有配置文件/内容配置文件字段
怎样才能实现这样的解决方案呢?
发布于 2011-03-31 02:28:29
我也有同样的问题。我发现,如果我按node.type =‘博客’过滤,并为我感兴趣的个人资料字段设置字段,我可以得到一个列表或作者,但会有重复的。将' distinct‘设置为Yes无济于事,因为它选择的是distinct节点,而不是distinct用户。
因此,我最终创建了一个自定义块来显示此信息,代码如下:
<?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'));
?>希望这能有所帮助。
https://stackoverflow.com/questions/4889591
复制相似问题