Random member with avatar and profile fields on front page - Drupal

I have a website in Drupal 5.x.

I need to have ONE random user at a time on the front page (using advanced front page module) with their avatar, profile_organame, profile_briefdescription, profile_profile, profile_location (etc).

But I only want random members WITH an avatar to be shown... I need the others without an Avatar NOT to be shown.

Need this pretty speedy, thanks.
Lambo_OOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oliverpoldenCommented:
You can do this with the views module.

Set sort order to Global: Random for your random order. Everything else should hopefully be self explanatory.
0
Lambo_OOAuthor Commented:
Oliver, I dont know how to use views on the front page using the advanced front page module, Ideally, looking for a quick code snippet.

thanks
0
Lambo_OOAuthor Commented:
I managed to figure this out - here it is if someone else needs info.

I could however do with help on limiting the number of characters printed from profile_profile if anyone knows how to limit this output - css doesnt really seem to help.

<?php
$count = 1;

$no_avatar = "http://www.mywebsite.com/files/systemfiles/jitter-1.PNG";
$result = db_query_range(db_rewrite_sql("SELECT * FROM {users} u ORDER BY RAND()"), 0, $count);
  while ($user_info = db_fetch_object($result)) {
    if($user_info->uid){
      if($user_info->picture){
      print "<a href=\"/user/$user_info->uid\" title=\"View $user_info->name's profile.\">";  print '<img src="/'.$user_info->picture.'" height=90 width=90 alt="Visit this user profile.">'; print '</a>';
profile_load_profile($user_info);
     print "<html><br><br></html>";
     print $user_info->name;
     print "<html><br><br></html>";
     print $user_info->profile_BriefDescription;
     print "<html><br><br></html>";
     print $user_info->profile_profile;
     print "<html><br><br></html>";
     print "<html> ... </html>";


}
       else {
      $result = db_query_range(db_rewrite_sql("SELECT * FROM {users} u ORDER BY RAND()"), 0, $count);
       }
    }

  }
?>


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lambo_OOAuthor Commented:
This may help others - I solved the character limit using substr. np.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.