Drupal: Display a block of random members with picture and basic info
<?php
$fields = array();
$result2 = db_query('SELECT name, title, type, visibility, weight FROM {profile_fields}
WHERE name IN ("profile_full_name", "profile_country") ORDER BY weight');
while ($record = db_fetch_object($result2)) { $fields[] = $record; }
$count = 2;
$Block_h = $count * 85;
$result = db_query_range(db_rewrite_sql("SELECT * FROM {users} u Where
CHAR_LENGTH(picture) > 0 ORDER BY RAND()"), 0, $count);
while ($user_info = db_fetch_object($result)) {
$user_info = user_load(array('uid' => $user_info->uid));
$profile = _profile_update_user_fields($fields, $user_info);
// $output .= theme('profile_block', $user_info, $profile, true);
// $output .= theme('profile_listing', $user_info, $profile);
$output .= "<div class=\"profile\" style=\"height: 85px\">\n";
$output .= theme('user_picture', $user_info);
$output .= ' <div class="name">'. theme('username', $user_info) ."</div>\n";
foreach ($profile as $field) {
if ($field->value) {
$output .= " <div class=\"field\">$field->value</div>\n";
}
}
$output .= "</div>\n";
}
print("$output");
?>
Hi Cello,Tou dou ben ?I'm
Hi Cello,
Tou dou ben ?
I'm Franco-Americano-Brazilian ...I was born in Sao Paulo !
Pretty cool during the world cup, I get to see "my team" play nearly every day ;-)
To answer your question. Yes that is totally possible. Never done it, but should not be so hard.
Cheers,
C


delicious
digg
reddit
google
technorati
Dear Christophe D,I´m a
Dear Christophe D,
I´m a young brazilian designer trying to put a drupal site to work. Yes i´m a "newbie", but this just can´t stop me to lear. I was very interested in your article about "Display a block of random members with picture and basic info" it works (of course since you tested and published) but a hava a question... My i get a Snippets to show the user profile in the page that lists the "user´s blog"? I´ve made a page-blog.tpl.php for better control this list... is that possible?