Closed (works as designed)
Project:
Buddylist
Version:
5.x-1.0
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2007 at 15:25 UTC
Updated:
12 May 2020 at 02:33 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dldege commentedI have just a few days ago checked in a change to buddylist.module to allow better theming of the buddylist page (?q=buddylist). It would be quite easy to implement user pictures now.
http://drupal.org/node/163104
Here is the function
As you can see it would be very easy now to add in the user picture in each row of the table.
Comment #2
zottmann commentedHi!!
Thanks for the update!! I'll try that!!
I'm also finishing the translation of the buddylist module to brazilian portuguese. Should I send it to you in order to publish it?
Regards,
Carlos.
Comment #3
dldege commentedYou can create a new issue for the translation and attach the relevant files. Thanks,
Let me know if the theme hooks work out for you.
Comment #4
zottmann commentedOK!
I'll try to review the translation by the end of the week in order to send it to you. By the way, I didn't find a way to translate the text that resides in the database and is used for things like the body of e-mail messages, block titles, etc ... How can these texts be translated?
Thanks for the tip on the buddylist theming as well. I didn't have time to try it yet, but surely I will.
Thanks again,
Carlos.
Comment #5
zottmann commentedHi!
I've just changed the theme_buddylisting function like below:
$header = array(t('picture'), t('@buddy', buddylist_translation()), t('online'));
if (count($buddies)) {
foreach ($buddies as $buddy) {
$rows[] = array(theme('picture', user_load(array('uid' => $buddy['picture']))), theme('username', user_load(array('uid' => $buddy['uid']))), theme('buddylist_online', $buddy['online']));
The header is beeing displayed ok, but the user pictures are not beeing shown.
Could you tell me what I'm missing?
Thanks in advance,
Carlos.
Comment #6
vm commentedshould post php using
<code>tags so we can see all of it.Comment #7
vm commentedanother note: this was rolled into the drupal 5 branch already per the other node posted. Thus I don't believe you need to add the function any longer. Please read the node posted above by dldege
Comment #8
dldege commentedyou want to call
theme('user_picture', user_load(array('uid' => $buddy['uid'])))is the problem I'm seeing on quick glance.Comment #9
zottmann commentedHi!
Thanks for the replies, dldege and VeryMisunderstood!
Dldeges' tip did the trick, but I still have one question. I've searched through the buddylist and user tables, but did not find any "user_picture" field. How does it work? Where does this field come from?
Anyway, thanks for the tips, and the next time i'll post code with code or ?php tags.
Regards,
Carlos.
Comment #10
vm commentedare user_pictures enabled in administer -> user settings ?
Comment #11
dldege commentedThe user picture is stored in the $user->picture variable when user pictures are enabled. Calling theme('user_picture', $user) ends up calling into the theme layer to determine how the picture is actually formatted and rendered in the HTML.
Here is the default handler for theme('user_picture', $user)
http://api.drupal.org/api/function/theme_user_picture/5
Comment #12
yngens commentedsubscribe
Comment #13
zottmann commentedHi!
Thanks for the explanation... I'm not a php programmer, so I'll need to study it a little in order to fully understand how the api works, but thanks anyway!
The important thing is that I was able to get the user pictures shown in the buddylist page...
Thanks again!
Carlos.
Comment #14
vrc3 commentedI altered the function buddylist_buddylisting_page
I changed:
to
and
to
Then I added this to my template.php:
NOTE: This assumes the existence of certain profile fields.
You can see the result here: www.beerreviewjournal.com, but you have to register to see buddylists...
Comment #15
jenlamptonThough this is very helpful, it didn't answer the question of how to add the pictures to the default view supplied with the module. This answers the question of how to add the photos to the 'buddylist' page. I've renamed this issue, and I will open a new one to address the previous question.
Jen
Comment #16
dldege commentedIn the current HEAD version - not the released version I have added a theme function to allow for complete control over the buddylist page - ?q=buddylist.
The process is really quite simple.
function theme_buddylisting($account, $buddies, $buddies_per_page)in buddylist.module - copy this whole function to the clipboard.mythemename_function theme_buddylisting($account, $buddies, $buddies_per_page). For example, I'm using the hunchbaque theme so I named itfunction hunchbaque_buddylisting($account, $buddies, $buddies_per_page)Comment #17
ZrO-1 commentedOK guys, I hope this thread is still active. I've modified the function so that the user picture is appended to the user name without adding an extra column to the listing table. Basically since the buddylisting function is a theme function you can override it in your template.php file. What I did was copy the entire theme_buddylisting function and pasted it into my template.php file and changed the "theme_" to "phptemplate_". Now I could modify the function all I wanted without modifying the buddylist.module file.
Here is my version of the function (if you're going to copy/paste this be sure to exclude the
<?php ?>part):So as you can see, this just inserts the picture in front of the name without adding a whole extra column to the table.
hope that helps.
Comment #18
ZrO-1 commentedLOL, it looks like dldege and I posted at about the same time.
Still though, his and mine are slightly different since my version doesn't add a new column. Other than that though either one should do the job.
Comment #19
dldege commentedEither version is fine - the important thing is to understand the process as this is how (ideally) you customize a large part of Drupal - take a look at all the
theme_functions in buddylist.module and you can start to see all the things you can change with this technique.Comment #20
mariusooms commentedIf anyone is interested for this functionality in buddylist2 and show buddies of the user you're currently viewing, check out this code you can import for views. http://drupal.org/node/229694
Comment #21
Surf New Media commentedAny ideas on adding the pictures to buddylist block?
Comment #22
d------ commentedThe block and the display on the profile page are both controlled by...
This can be overridden in template.php using....
I'm still figuring out what to put in the override function though ;)
Comment #23
socialnicheguru commentedsubscribing...
I do have a question though.
when i use views, buddylist returns a usernode and my exposed filters are based on that usernode.
but i want to use filters and show fields of the usernode->uid that are stored in other node profile. how do i do that? Is views fusion helpful??
Chris
Comment #24
drupalina commentedI tried both solutions of vrc3 (comment #14) and dldege #16, I think a vrc3 give a better solution because it also gives some profile details and importantly it gives us Buddy-actions, which make the surfing beteween individual buddylists a lot easier, and because it is more themable and more customizable. But it seems that the latest version of Buddylist-beta1 has some of these variables changed.
Could any of you coding gurus be kind enough to provide us with a theme template override to do display the following :
Avatar photo
Username
(preferably some profile fields so that we can change them accordingly)
Add to / Remove from my Buddylist
View that_username's Buddies
Send that_username a private message
(pretty much like Facebook was 1 year ago) -- I have seen MANY requests from Drupal users for this kind of listing of friends, but still there is no such code for us lesser mortals to use :(
Would some of you Drupal coders be kind enough to share this kind of code?
THANKS!
Comment #25
d------ commented