By Adrian-dupe on
Hi everyone !
I've got a little problem here.
I need to show the user's picture in the buddylist block, but I don't know how to do. I tried to modify the buddylist.module with no success.
This is the piece of code, I am working on. It returns a formatted list of users.
function buddylist_get_buddylist($user, $buddy_of = FALSE) {
if (user_access('view buddy lists') && !$buddy_of) {
$i = 0;
if ($buddies = buddylist_get_buddies($user->uid)) {
foreach(array_keys($buddies) as $buddy) {
$account = user_load(array('uid' => $buddy));
$listbuddies[] = $account;
$i++;
if ($i > variable_get('buddylist_prof_buddies', 5)) {
break;
}
}
return theme('buddylist', $listbuddies);
}
}
Thanks for the answers.
Comments
First of all: NEVER EVER
First of all: NEVER EVER change the module itself. First rule when 'playing' with drupal.
You can override functions using theme function and maybe add your own module, but never edit the module file.
If i understand correctly that you want the user buddies pictures, i've got a solution for you from another direction:
Creating a view that will display buddylist users pictures and then printing the view in the block.
(Requires of course views module)
I know this might be a little difficult if you lack of knowledge, just ask if something is unclear.
You need to, of course, change names to match your site, and maybe remove some fields.
Here is the code of the block (should be on php filter):
Here is the view code (that you need to import):
-- Yaron
thanks for the view import code!
However... I'm getting an "Unable to get a view out of that" message. Is there a prerequisite module I must have enabled to get this view to work?
Thanks!
THX A LOT ! ! ! !
Thank you so much ! It's working !
You need the usernode module...
Is it possible to customise this with css???? Like changing the block width??? Align the pictures ?