t0m
photos and stuff
  • Accueil
  • Photos
  • Carnets de voyage
    • Vénézuela
    • Europe centrale
    • Californie
    • New Orleans
    • Nevada, Utah, Arizona
    • Vénézuela 2009
    • Islande
    • Weekends
  • CV

Plugin Buddypress: TDLC Birthdays

110 Commentaires 14/10/2009

Update : want to reuse the plugin’s functions to display the age of members in your BP theme pages ? I wrote a snippet for that :)

English below

J’administre un site communautaire basé sur WordPress MU et Buddypress. Jusqu’à aujourd’hui j’ai toujours pu me procurer des plugins pour mettre en place les fonctionnalités dont j’avais besoin. Mais cette fois je cherchais à afficher les anniversaires des membres du site sur la page d’accueil, et à mon grand étonnement je n’ai rien trouvé.

J’ai donc décidé de développer mon premier Widget pour cette plate-forme : TDLC Birthdays

Le plugin est en français et en anglais (et en 7 autres langues :) ), c’est pourquoi la suite du post, qui est est basée sur le readme du plugin, est en anglais…

Description

WARNING: Since version 0.2, the plugin is designed for Buddypress 1.2. If you run an earlier version of Buddypress, please use version 0.1.7. Also, please note that Buddypress 1.5+ requires v0.3.2+ of the plugin.

This is a Plugin that creates a ‘Birthdays’ Widget that you can use in your Buddypress pages. Once you’ve created a datebox field in the Buddypress profiles and referenced it in the TLDC Birthdays widget settings, the widget will display the list of either all BP users or just the connected user’s friends whose birthday is today and also, if you like, the list of upcoming birthdays within the next n days. Plugin now supports Andy Peatling’s Buddypress Followers plugin when installed, so that you can also track the birthdays of people you follow.

So to sum up, in order to get things to work, you’ll need :

  • A birthday field in the Buddypress extended profile settings
  • Users to fill it out in their profiles
  • The TDLC Birthdays widget properly installed and set up (see Installation)

Remarks :

  • Localized! Currently English, French, German, Hungarian, Italian, Japanese, Polish, Russian and Spanish languages are included. Many thanks to the translators!
  • Sounds obvious but in « display friends only » mode, as you only see your friend’s birthdays, you wont see your own birthday in the widget. This does not mean that your friends don’t see it either! Same thing goes with the Followers option.

Installation

This section describes how to install the plugin and get it working.

  1. Download the archive on the WordPress Plugin Directory and expand it.
  2. Upload the tdlc-birthdays folder into your wp-content/plugins/ directory
  3. In your WordPress Administration Area, go to the Plugins page and click Activate for TDLC Birthdays
  4. In the Widgets page, you can now add the Birthday plugin wherver you like. Please note that the widget requires compulsory settings.

Settings

  • In order to get the widget working, you need to fill out the Birthday field Name (or ID). The Birthday field must have been previously created in the Buddypress profile page (and it should be a datebox type field). Of course, the users must also fill it out on their profile pages…
  • The other settings are self-explanatory (or at least I hope so).
← Les photos du voyage au Vénézuela en HD
Cologne (aka Köln) →

110 réponses à Plugin Buddypress: TDLC Birthdays

  • Steve 05/07/2011

    Hi Tom,

    It has just gone midnight here and is now July 6th, yet the sidebar widget is still saying Happy Birthday to those people on June 5th – it will now stay like this until 10:00am on the 6th before the birthdays change to from June 5 to June 6.

    I hope you can assist.

  • Tom 06/07/2011

    Hi Steve,

    Ok so maybe the fact that the server time is UTC +10 as well is the cause. Just to check, could you edit your tdlc-birthdays.php file, and replace line 78 :

    $this->serveroffset = get_blog_option(BP_ROOT_BLOG, ‘gmt_offset’) * 3600;

    with this :

    $this->serveroffset = date_offset_get(new DateTime) – get_blog_option(BP_ROOT_BLOG, ‘gmt_offset’) * 3600;

    and give it a shot ?

    Thanks
    Tom

  • Steve 06/07/2011

    Hi Tom,

    Thanks again for your quick response. Doing the above returns the following error:

    Parse error: syntax error, unexpected T_STRING in /home/username/public_html/wp-content/plugins/tdlc-birthdays/tdlc-birthdays.php on line 79

  • Mike Kennedy 02/08/2011

    Does this work with BP 1.5? If not, are you going to update it? :)

  • Tom 03/08/2011

    Hi Mike. Not tested yet, but if you do first, please let me know how it goes ! In any case, I’ll update if required.

    Also, in non related news, important update coming, introducing Chestnut’s Japanese translation, better GMT offset management that should fix Steve’s issue, and last but certainly not least, less stupid database queries that should improve widget performance a lot (like, a LOT) for BP installs with many users.

    Cheers :)

  • Chestnut_jp 04/08/2011

    Hi Tom,

    Thank you very much including Japanese translation I made to the latest relase.

    Unfortunately, however, I have to downgrade the plugin to 0.2.8, because 0.3 does not work for me.

    In the 0.3, you use « private $localnow » in order to fix the date that date() function outputs.

    Well, you do not need to make your own variable like $localnow, as WordPress provides the « date_i18n() » function.

    The date_i18n() function always outputs the localtime while date() function outputs based on GMT.

    For instance, date(« n »,$this->localnow) equals to date_i18n(« n »), and date_i18n() which is provided by WordPress should be used in the plugin.

    I am sorry that I did not have time to submit my fixed 0.2.8 version, but as I mentioned above, the 0.3 does not work so I downgraded the plugin to the 0.2.8 in which I fixed date() function to date_i18n() function.

    If you need my fixed version of 0.2.8, let me know and I will send it to you via email.

    Nevertheless, I still have one problem, which I suppose remains in the latest 0.3.
    The problem is that changed options do not appear to be saved. For example, changing « Hide ages » from Yes to No is not saved. I tried to change the value of « Display birthdays happening in the next: », and the value has remained unchanged.

    I hope these problems are solved in the near future.

    Thanks in advance,
    Chestnut

  • NoahY 16/08/2011

    Merci beaucoup – c’est un plugin très utile!

    J’ai une suggestion si tu veux. Si on ajoute:

    $options = get_option(« widget_tdlcBirthdays »);
    if(!xprofile_get_field_data($options['bdfid'], $bp->loggedin_user->id)) echo ‘loggedin_user->domain . $bp->profile->slug . ‘/edit/ »>add your date of birth‘;

    dans la fonction « printBirthdays », il y aura un lien pour ajouter votre anniversaire dans le bas du widget, si vous n’avez pas déjà fait.

  • Jeff 17/09/2011

    Just a heads up. In BuddyPress 1.5, the date field is stored as a date, not a timestamp.

    2006-06-22 00:00:00

    Which causes the plugin to break as it returns invalid dates. Took me a while to figure this out.

  • Tom 18/09/2011

    Hi Jeff,

    thanks for the heads up. I guess it answers Mike’s question: the plugin is not yet compatible with BP 1.5

    If you fixed it already I’d be grateful if you could send me the code ! Otherwise I’ll try to release an update in the coming weeks.

  • Tom 10/10/2011

    Hi guys, just to let you know that I’ve found and fixed the BP1.5 incompatibility with user metadata (birthdate) in v0.3.2 which I will release soon.

    Thanks again Jeff for the heads up, that spared me some time!

    Edit : released! Also includes the feature suggested by NoahY :)

« Commentaires plus anciens
Commentaires plus récents »

Laisser un commentaire

Cliquez ici pour annuler la réponse.

Poster le commentaire

Mon facebookMon flickrMon linkedinMon rssMon twitter
© 1984-2012 t0m - theme by Switched on Media
  • CV
  • À propos