Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

[SOLVED]Module Happy birthday

[SOLVED]Module Happy birthday

Hello,

Congratulations for your module, it is very useful.

How to show a module of "Happy Birthday" for a User, using the field cb_birthday?

Grateful ... Sorry my bad English.

Edited By: sniper_rio
17-Nov-09 20:21:08

sniper_rio
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Re: [SOLVED]Module Happy birthday

Hi sniper_rio,

How about this:

Code:

if ($user->id > 0) {

    $sql = 'select * from #__comprofiler where user_id = ' .  (int)$user->id;
    $db->setQuery( $sql, 0, 1 );
    $row = $db->loadObject();
    if ($row && substr( $row->cb_birthday, 5) == sprintf("%02d-%02d", MM_MONTH, MM_DAY_OF_MONTH) ) {
        return "101"; /* happy birthday module! */
    }
}

You just need to customise 2 things here:

1 - make sure that "$row->cb_birthday" in the recipe above matches the name of the birthday parameter in CommunityBuilder. e.g. if you have named the parameter "cb_birthdate" then you have to change that here to match.

2 - replace "101" with the module id of the module you want to display on their birthday.

Also, you might want to think about what time zone you set up in MetaMod -- use the drop-down list for the timezone to find the most appropriate one for your viewers. The default one is usually ok (it defaults to the time zone Joomla is set up with), but the default Joomla timezone system does not respect daylight savings time. If you use the timezone settings in MetaMod, then these ones DO respect daylight savings times.

Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: [SOLVED]Module Happy birthday

Thanks Stephen, worked perfectly.

Big hug from Brazilian friends

sniper_rio
Beginner Modder
ranks
useravatar
Offline
15 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5161
Newest User:
kbmgkey234q
Members Online:
0
Guests Online:
485

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked