If a user is new s/he will have an empty buddylist. On pages where I provide the buddylist block this block is not shown. This can "destroy" your layout (i.e. a change from 3 to 2 column layout), if it is the only block in a sidebar.
Another reason to show the block even with empty list is that I want to show to new users that we have a buddylist functionality on the site to make them networking socially as soon as possible. If I put a little provoking text in it like "fred hasn't got friends" s/he might feel embarressed but sure s/he wants to change that immediatly! ;) (I made this experience myself on another social networking site - hated it, but it worked!) :D
The changes I want are simple:
- Additional settings:
- Checkbox whether the admin wants appearing buddylist-blocks, default is the common behaviour (not show up if list is empty)
- Textarea containing a suggested message "You made no buddies, yet. You can change this by..."
- Function that supplies the message text
- Changing buddylist_block() and put another if-clause into it
I provide my suggestion as a patch as attachment. This is my first done patch ever, so please be patient. Any response on how to improve my patches are welcome since I'm already working on another feature I would like to share. I'm working with Drupal 5.0 so this patch is created for the buddylist 5.x branch.
Hope it helps!
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | buddylist.module.02192007.patch | 6.2 KB | joshk |
| #16 | buddylist.module.2007-02-12.patch | 4.28 KB | marcor |
| #12 | buddylist.module.2007-02-11.patch | 4.18 KB | marcor |
| #8 | buddylist.module_2.patch | 4.01 KB | marcor |
| buddylist.module_1.patch | 3.38 KB | marcor |
Comments
Comment #1
AstralP commentedI've just dealt with exactly the same problem... wish I'd seen this earlier :)
This is what I did anyhow:
Find this:
replace with this:
Comment #2
marcor commentedHi AstraIP, thanks for your lean approach that will fit perfectly your special needs. :)
Explore my patch as it might be more configurable for you. Changes are explained above. And I realize it's working well and stable on my site. Please give a note if the patch is accepted for I'm working on further buddylist enhancements. Buddylist is a real cool module having an exciting future!
More ideas shared next time. ;)
Comment #3
AstralP commentedHi MarcoR
I will give it a go when I get a chance, I'm close to putting my site live and still have a fair bit to do, I will then gve it a go in my sandbox :)
Does your patch check whether the current user is the owner of the page? This is important to me as it allows 2 different messages to be displayed. If not would you consider adding it?
Andy
Comment #4
robertdouglass commentedWhen you two make some progress on this please set back to patch (needs review). Thanks.
Comment #5
marcor commentedHi AstraIP, the "My buddy list" block always shows the buddies of the current user. Why do you want to check for "edit access"? Please explain... Usually every user can change his own buddylist - it would be evil to make fun of him without offering the chance to change.
It would make sense in two ways:
Until then the code would do. I'll post it here to give an overview:
Comment #6
AstralP commentedI've just been implementing my change to your code and realized that I have completely mis-understood what this block does... I was thinking in terms of the myspace friends section so that this block shows a users friends. But I now understand it correctly it always shows the current logged in users friends... sorry for the misunderstanding. I will have to work on a solution for what I was expecting.
I've implemented your patch and all appears to working well anyhow, nice job :) I see no reason for it not to be committed.
Comment #7
robertdouglass commented@MarcoR: if you can provide a current patch I'll make sure this gets reviewed.
Comment #8
marcor commentedHi! Thanks for the nice talk that kept my brain active!
@AstraIP: This block you intended to change would be ***very*** appreciated! I would like to collaborate, if you have a suggestion! :)
@robertDouglass: I'm not so familiar with diff and patch, yet. I hope this patch will do (otherwise please tell me). Generated it with diff -up from the current cvs.
This was not easy because - as I said before - I'm working on further changes for the buddylist.module and had to copy&paste everything again. I agree in dividing each patch an issue, but this seems to be so slow. So, I would like to work with cvs instead to parallize improvements. Even though my practical experience is at a beginning state I know enough about the advantages to be willing to learn it!
Comment #9
robertdouglass commented@MarcoR: Thanks for providing a patch. I'll review as soon as I can.
Working with CVS and making patches is a natural match. Here, a tool like Eclipse is invaluable, and I keep Eclipse around just for this purpose. When you synchronize with the CVS repository in Eclipse, it lets you keep some changes and replace others, so you can take a copy of your module that has many changes in it, and easily see exactly which ones apply to a certain feature or aspect you're working on. Then roll a patch based on those.
Anyway, Drupal thrives on the patch model of development (as does Linux and many other OS projects), so your efforts to learn will not be wasted.
The best patches also include this:
-F^fThat tells diff to tell you what function the change occurs in and makes it easier for humans to read.
Comment #10
marcor commented@ robertDouglass: Thank you very much for your explainations! :)
I promise I will dive into CVS! Instead of eclipse: Had some warm-up with command-line cvs. And last weeks, Zend became a new friend of mine, maybe I can convince him doing those CVS stuff for me ;)
Regarding the patch: I'm not sure about the nesting of the t() functions. Please have a closer look onto it, because I could not test it.
How do I create a new template file for translation? I'd love to work on a new german translation because I need this for my own project (just using Drupal's string search is not sophisticated enough)
Comment #11
fagoI agree that this functionality would be a nice feature, so thanks for your work marcor!
However I'd like to see some improvements for the patch:
Comment #12
marcor commentedThanks for your help, fago, I made the changes as you said. This was quite easy with your explainations and went really fast.
But: Creating a patch is getting harder each time as I went forward doing some little improvements here and there without having a well arranged working environment, yet. Robert gave some nice hints that go in the right direction, I totally agree with that, but I could not aplly them because I work with another environment and started working on other issues already. Although I just use one buddylist.module file in my webserver's directory I now have dozens of .orig .cvs .new files and some more .2007-02-11-files now in some different directories that really made me mad today. I would really like to know how this could be made simplier. I would really like to give back my improvements to you and I understand the necessarity of breaking changes into issues and reviewing each issue, but I cannot spend some days just for bringing in one patch. Any suggestions are welcome on that.
I think this one is done.
Comment #13
robertdouglass commentedMarcoR: hehe... everybody wants to know the perfect way to develop =) One thing you could do is always start from the Drupal CVS version and keep your changes in some other form, such as your own revision control (SVN works nice for this since it doesn't conflict with CVS), or in patches. I always start development from a clean CVS version.
Comment #14
marcor commentedOk, next time! ;)
As I just noticed, the t() nesting is not working this way I did it now.
Anyone?
Comment #15
marcor commentedSorry, I should explain: @buddy is not substituted anymore.
I'm out of time for today, I pick this up some days later if it's still active.
Comment #16
marcor commentedOk, the error I noticed yesterday was no error, it was a special effect inducted from the database-entries I already had before the changes.
Anyway I've made a one-char-improvement compared to the yesterday-patch, that was it worth! :)
Besides, this time I did the patch using
cvs diffinstead ofdiff. The diff was made against the HEAD version. This was pretty fast and easy!Comment #17
joshk commentedThis looks good to me. It applies cleanly and works as advertised. Nice work! This is very good functionality.
The only improvements I would make would be to clean up the admin screen a bit. Most importantly, the settings for the "My buddies list" block that are added don't appear adjacent to the existing setting for the block title. This is going to confuse people. I've used FormAPI's #weight attribute to put them all at the bottom of the blocks fieldset.
I've also changed the language in the #description attributes slightly to make it more explicit, and to refer to "the checkbox above" since we're positioning these form elements precisely.
The language is a matter of opinion, but I think the #weight element should definitely be added to prevent confusion.
I've attached a patch with these minor changes. What do you think, MarcoR?
Comment #18
joshk commentedMistakenly marked "code needs work." I'd just like to get Marco's review for these improvements and then I can commit.
Comment #19
marcor commentedJust patched it, great improvements, thank you joshk!
As you will have been noticed, I'm no native speaker, so these improvements are very welcome.
It's REALLY to much of honor to let ME decide to check in... but alright: "ENERGY!"
Comment #20
joshk commentedI'll commit this ASAP. Sorry for letting it lag.
Comment #21
joshk commentedCommitted to 5.0 and HEAD branches. Thanks MarcoR!