2011-02-03 2 views
0

보기를 사용하는 drupal6에서 일부 특정 노드 유형 및 분류학 용어의 작성자 목록 (전체 프로필 필드 포함)이 필요합니다. .ID 또는Drupal보기 : 노드의 저자 목록 node.type = abc 및 node.vocabulary_id = 123

을 vocabulary.id

요약 쿼리
조회수 : 유형 사용자
인수 : 기간의 ID/어휘 ID
필터 : 노드 유형 ABC
필드의 저자 : 모든 프로필/컨텐츠 프로필 필드

어떻게 그런 해결책을 얻을 수 있습니까?

답변

1

동일한 문제가 있습니다. 나는 node.type = 'blog'로 필터링하고 관심있는 프로필 필드의 필드를 설정하면 목록이나 저자를 얻을 수 있지만 중복이 있다는 것을 알았습니다. 'Distinct'를 Yes로 설정하면 별개의 사용자가 아닌 별개의 노드를 선택했기 때문에 도움이되지 않았습니다.

그래서 나는이 같은 일부 코드를 사용하여이 정보를 표시하는 사용자 정의 블록을 생성 결국 : 도움이

<?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')); 
?> 

희망을.