如果不使用views,你想建立一个显示用户姓名,图片,信息字段的页面,你可以按下面的步骤:
1,建立一个页面
2,插入下面的代码
3,确保输入格式允许Php
下面的代码建按字母每页显示 50个用户
<?php
// Compile a list of fields to show.
$fields = array();
$result = db_query('SELECT name, title, type, weight FROM {profile_fields} WHERE visibility = %d ORDER BY category, weight', PROFILE_PUBLIC_LISTINGS);
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
// v.fid = 1 is the include in member gallery checkbox
// If the field contains integer values use ORDER BY ABS(v.value) to force numeric sorting
//Change the 50 to display more or less users per page
$result = pager_query("SELECT u.uid, u.access FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = 1 ORDER BY u.name, v.value ASC", 50, 0, NULL);
$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);
return $output;
?>
最新评论