By Mets on
Hey everybody,
I'm tryinbg to make a block to go along with the buddylist module. The block will show a few random people that the user has marked as a friend, along with their picture. The only problem is, I'm not really sure how I could go about doing this, so I'm lookng for any sugestions/help. I know enough PHP to get around, but not enough to site down and start coding something like this from scratch. Any help would be great.
Mets
Comments
this is what I use
to display a random user from a specific role (Staff in this case). It should be easy to adapt this code for your use.
Thanks a million for the
Thanks a million for the help munga - that would have taken me a while to come up with! I've checked the code several times and seem to be able to get it to work in PHP-Eclipse, however, when I try the code that you gave me on the live server, I'm getting this error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' role r ON ur.rid = r.rid AND ur.uid = u.uid WHERE u.picture LIKE '%files/pictur' at line 1 query: SELECT u.uid FROM users u LEFT JOIN users_roles ur, role r ON ur.rid = r.rid AND ur.uid = u.uid WHERE u.picture LIKE '%files/pictures%' ORDER BY RAND() LIMIT 1 in C:\apachefriends\xampp\htdocs\drupal\includes\database.mysqli.inc on line 121.I doubt its an SQL syntax problem...any ideas? I actually saw something like this with another code segment at http://drupal.org/node/36822. I'm running 4.7.1
Thanks again, Mets
here's a start
Ok I did some more looking and I put this together:
This does a good job of displaying six users, however:
1) it shows 6 users from the entire site - not 6 users from a person's buddy list
2) I'm not sure if they are 6 random users or just the first 6 users who registered on the site
3) the picture is not printing at all. I've played around with it, and the code seems ok, but no pictures show for those users which have a photo
Also, if it would be possible to get it in two columns I'm going to try to do that - probably something with divs - but right now I'm just trying to get 1-3. Any help would be much appreciated!
Better late than never - use in user profile override page
Hi bud,
Had the exact same problem you did, fiddled with some php, css, altered another drupal user's code, and here's what i got: (works with 4.7)
How to get this working in
How to get this working in Drupal 6 ?