Список пользователей определенной роли + данные из профиля



Drupal 5.x

<?php
$rid
= 4// номер роли > 2
?>

<?php
    $fields
= array();
   
$result = db_query('SELECT name, title, type, weight FROM {profile_fields}  ORDER BY category DESC, weight');
    while (
$record = db_fetch_object($result)) {
     
$fields[] = $record;
    }
$result = pager_query("SELECT u.uid, u.name, u.status, u.created, u.access FROM {users} u INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = $rid ORDER BY access DESC", 20, 0, NULL);
$status = array(t('blocked'), t('active'));
$output = '<div id="profile">';
while (
$account = db_fetch_object($result)) {
 
$account = user_load(array('uid' => $account->uid));
 
$profile = _profile_update_user_fields($fields, $account);
 
$output .= theme('profile_listing', $account, $profile);
}
$output .= '</div>';
$output .= theme('pager', NULL, 20);
print (
$output);
?>

Drupal 4.7.x

<?php
    $rid
= 4// номер роли > 2
   
$fields = array();
   
$result = db_query('SELECT name, title, type, weight FROM {profile_fields} WHERE visibility = %d ORDER BY category DESC, weight', PROFILE_PUBLIC_LISTINGS);
    while (
$record = db_fetch_object($result)) {
     
$fields[] = $record;
    }
$result = pager_query("SELECT u.uid, u.name, u.status, u.created, u.access FROM {users} u INNER JOIN {users_roles} ur ON u.uid=ur.uid WHERE ur.rid = $rid ORDER BY access DESC", 20, 0, NULL);
$status = array(t('blocked'), t('active'));
$output = '<div id="profile">';
while (
$account = db_fetch_object($result)) {
 
$account = user_load(array('uid' => $account->uid));
 
$profile = _profile_update_user_fields($fields, $account);
 
$output .= theme('profile_listing', $account, $profile);
}
$output .= '</div>';
$output .= theme('pager', NULL, 20);
print (
$output);
?>

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.