UBB.Dev
Posted By: blaaskaak Custom island happy birthday - 09/08/2007 12:34 AM
A custom island that mentions today's birthdays!

see attachments smile

Enjoy!


Description: [goodisland] The instructions on how to install this island.
Attached File
readme.txt  (122 downloads)

Description: [goodisland] the cody for the island
Attached File
happybirthdayisland.txt  (130 downloads)

Description: 7.3 version
Attached File
birthdaymod-7-3.txt  (32 downloads)
Posted By: sirdude Re: Custom island happy birthday - 09/08/2007 3:07 AM
dude, i so wanted to do that and it was on my list of 'sh*t i want to do, but don't have time'

ty blaaask!!!!!
Posted By: sirdude Re: Custom island happy birthday - 09/08/2007 3:11 AM
boom.. quickest 'mod' ever. copy/paste, cpanel enable.. *poof*

workie..

i bow to you!
Posted By: AshtarRose Re: Custom island happy birthday - 09/08/2007 6:10 AM
so easy I could do it lol
Posted By: Gizmo Re: Custom island happy birthday - 09/08/2007 8:04 AM
Great job blaaask! Love it hehe... I am however moving you up to the templates forum wink...
Posted By: blaaskaak Re: Custom island happy birthday - 09/08/2007 9:40 AM
Originally Posted by sirdude
dude, i so wanted to do that and it was on my list of 'sh*t i want to do, but don't have time'


I didn't have the time too, so I copied over most of the code from the public calender island smile
Posted By: blaaskaak Re: Custom island happy birthday - 09/08/2007 11:30 AM
I just added v2.00 to post #1.

This one ignores banned users and users with a last visit day of more then X days ago (I set it to 60 days default).
Posted By: sirdude Re: Custom island happy birthday - 09/08/2007 5:54 PM
hrm i have a v2.10 now for the banned guys..

for them, the string is 'Happy Bday, you Lahewwwwwzer ..'

laugh
Posted By: jgeoff Re: Custom island happy birthday - 09/09/2007 8:01 AM

Very nice... thanks!! cool
Posted By: sirdude Re: Custom island happy birthday - 09/09/2007 4:41 PM
we need v2.10 (colorize names - based upon Display color, admin, mod) laugh
Posted By: blaaskaak Re: Custom island happy birthday - 09/10/2007 7:22 AM
Originally Posted by sirdude
we need v2.10 (colorize names - based upon Display color, admin, mod) laugh


v2.10 is already there, with the banned guys special messages.

So that would be v2.20 atleast smile
Posted By: blaaskaak Re: Custom island happy birthday - 09/10/2007 10:00 PM
Originally Posted by blaaskaak
So that would be v2.20 atleast smile


v2.20 it is smile

added name color stuff, stolen (but redid some of the if's) from showflat.inc.php smile

Code
/* PHP CODE HERE */

$maxdaysago=60;

$temp = getdate($now);
$month = $temp["mon"];
$mday = $temp["mday"];
$year = $temp["year"];

$visitlimit=time()-60*60*24*$maxdaysago;

if (isset($config['BIRTHDAYS_IN_CALENDAR']) && $config['BIRTHDAYS_IN_CALENDAR']) {
$query = "
SELECT t1.USER_DISPLAY_NAME,t2.USER_BIRTHDAY,t1.USER_IS_UNDERAGE,t1.USER_ID,t2.USER_NAME_COLOR
FROM {$config['TABLE_PREFIX']}USERS as t1,
{$config['TABLE_PREFIX']}USER_PROFILE as t2,
{$config['TABLE_PREFIX']}USER_DATA as t3
WHERE t2.USER_BIRTHDAY LIKE ?
AND t1.USER_IS_BANNED != '1'
AND t2.USER_PUBLIC_BIRTHDAY = '1'
AND t3.USER_LAST_VISIT_TIME >= ?
AND t1.USER_ID = t2.USER_ID
AND t1.USER_ID = t3.USER_ID
";
$sth = $dbh -> do_placeholder_query($query,array("$month/$mday/%",$visitlimit),__LINE__,__FILE__);
$marray[0] = "";
while(list($uname,$birthday,$coppauser,$birthdayuser,$Color) = $dbh -> fetch_array($sth)) {
@list($bmonth,$bday,$byear) = @split("/",$birthday);
$age = "";
if ($config['AGE_WITH_BIRTHDAYS'] && !$coppauser) {
$age = $year - $byear;
$age = " ($age)";
} // end if
$Color = trim($Color);
if ($Color)
{
$uname = "<span style=\"color:$Color;\">$uname</span>";
}
else
{
if ($PostStatus == "Administrator")
{
$uname = "<span class=\"adminname\">$uname</span>";
}
elseif ($PostStatus == "Moderator")
{
$uname = "<span class=\"modname\">$uname</span>";
}
}

$bdays .= "<a href=\"{$config['BASE_URL']}/ubbthreads.php?ubb=showprofile&User=$birthdayuser\">$uname</a>$age, ";
} // end while
} // end if
if (!$bdays)
{
$bdays="No birthdays today";
}
else
{
$bdays = substr($bdays,0,strlen($bdays)-2);
$bdays = "Happy birthday ".$bdays.".";
}
/* BODY HERE */
$body = <<<EOF
$bdays
EOF;
Posted By: sirdude Re: Custom island happy birthday - 09/10/2007 11:31 PM
mr blaaask.. sexaaay...!
Posted By: AllenAyres Re: Custom island happy birthday - 09/11/2007 10:49 PM
Very nice, I'm gonna try this one smile
Posted By: Ian_W Re: Custom island happy birthday - 09/15/2007 12:58 PM
Many thanks smile
Posted By: AshtarRose Re: Custom island happy birthday - 09/16/2007 6:58 PM
My other Admin Caught this:

I noticed that the birthday thing on the main page was not actually doing its job, so have changed the cache setting so it actually shows up the people whose birthday it is. Guess why I noticed it doesn't work lol. Hope you don't mind!
Balance
Posted By: Ian_W Re: Custom island happy birthday - 09/16/2007 10:15 PM
Showing fine on our site smile
Posted By: sirdude Re: Custom island happy birthday - 09/22/2007 10:57 PM
fyi,

for 7.3 the colorizing will be easier. just do:
PHP Code
$uname = $html->user_color($uname, $Color, $PostStatus); 
and it's done for you.

this will also take into account the globalmod color. :2c:

good stuff blaask wink
Posted By: sirdude Re: Custom island happy birthday - 09/22/2007 11:28 PM
hrm, you have a bug. $PostStatus is undefined.. fyi

Code

SELECT t1.USER_DISPLAY_NAME,t2.USER_BIRTHDAY,
t1.USER_IS_UNDERAGE,t1.USER_ID,t2.USER_NAME_COLOR,
t1.USER_MEMBERSHIP_LEVEL

and
Code

while(list($uname,$birthday,$coppauser,$birthdayuser,$Color,$PostStatus) = $dbh -> fetch_array($sth)) {

i believe smile
Posted By: blaaskaak Re: Custom island happy birthday - 09/23/2007 3:20 AM
that looks about right smile

I'll have a cleanup on post #1 tomorrow. There's a nice comfy bed waiting now.
Posted By: blaaskaak Re: Custom island happy birthday - 09/23/2007 3:31 AM
Nice comfy bed could wait...

Code
/* PHP CODE HERE */

$maxdaysago=60;

$temp = getdate($now);
$month = $temp["mon"];
$mday = $temp["mday"];
$year = $temp["year"];

$visitlimit=time()-60*60*24*$maxdaysago;

if (isset($config['BIRTHDAYS_IN_CALENDAR']) && $config['BIRTHDAYS_IN_CALENDAR']) {
$query = "
SELECT t1.USER_DISPLAY_NAME,t2.USER_BIRTHDAY,t1.USER_IS_UNDERAGE,t1.USER_ID,t2.USER_NAME_COLOR,t1.USER_MEMBERSHIP_LEVEL
FROM {$config['TABLE_PREFIX']}USERS as t1,
{$config['TABLE_PREFIX']}USER_PROFILE as t2,
{$config['TABLE_PREFIX']}USER_DATA as t3
WHERE t2.USER_BIRTHDAY LIKE ?
AND t1.USER_IS_BANNED != '1'
AND t2.USER_PUBLIC_BIRTHDAY = '1'
AND t3.USER_LAST_VISIT_TIME >= ?
AND t1.USER_ID = t2.USER_ID
AND t1.USER_ID = t3.USER_ID
";
$sth = $dbh -> do_placeholder_query($query,array("$month/$mday/%",$visitlimit),__LINE__,__FILE__);
$marray[0] = "";
while(list($uname,$birthday,$coppauser,$birthdayuser,$Color,$PostStatus) = $dbh -> fetch_array($sth)) {
@list($bmonth,$bday,$byear) = @split("/",$birthday);
$age = "";
if ($config['AGE_WITH_BIRTHDAYS'] && !$coppauser) {
$age = $year - $byear;
$age = " ($age)";
} // end if
$Color = trim($Color);
$bdays=$VERSION;
if ($VERSION<'7.3')
{
if ($Color)
{
$uname = "<span style=\"color:$Color;\">$uname</span>";
}
else
{
if ($PostStatus == "Administrator")
{
$uname = "<span class=\"adminname\">$uname</span>";
}
elseif ($PostStatus == "Moderator")
{
$uname = "<span class=\"modname\">$uname</span>";
}
}
} else
{
$uname = $html->user_color($uname, $Color, $PostStatus);
}

$bdays .= "<a href=\"{$config['BASE_URL']}/ubbthreads.php?ubb=showprofile&User=$birthdayuser\">$uname</a>$age, ";
} // end while
} // end if
if (!$bdays)
{
$bdays="No birthdays today";
}
else
{
$bdays = substr($bdays,0,strlen($bdays)-2);
$bdays = "Happy birthday ".$bdays.".";
}
/* BODY HERE */
$body = <<<EOF
$bdays
EOF;

Fixes colorize bug, and introduces compatibility with 7.3 smile Untested that is laugh


Cleanup for post #1 I will still do tomorrow smile

Update: Hmm, doesn't seem to work yet, I'll have a test drive tomorrow smile Don't know if the $VERSION variable is available in a custom island.
Posted By: AshtarRose Re: Custom island happy birthday - 09/23/2007 4:47 AM
How about one that lists birthdays for the month instead of per day?
Posted By: blaaskaak Re: Custom island happy birthday - 09/23/2007 10:46 AM
Originally Posted by AshtarRose
How about one that lists birthdays for the month instead of per day?


could be a busy screen if you have a lot of members. But "a month from now", because "in thos month" is not so interesting. It's not so interesting to see if somebody had it's birthday 30 days ago.
Posted By: blaaskaak Re: Custom island happy birthday - 09/23/2007 11:23 AM
Originally Posted by blaaskaak
I'll have a cleanup on post #1 tomorrow.


The bed was very comfy smile

Post #1 now has been cleaned up with the latest greatest version, with the color stuff fixed for mods/admins.
Posted By: AshtarRose Re: Custom island happy birthday - 09/24/2007 6:57 AM
Why are there lines all through it, is it safe to use?
Posted By: blaaskaak Re: Custom island happy birthday - 09/24/2007 8:52 AM
No, I crossed it out because I didn't want to clear the messsage clear, but the code wasn't working in that message. Just take the island from post #1. There is always the most up-to-date, tested, version there!
Posted By: AshtarRose Re: Custom island happy birthday - 09/24/2007 5:24 PM
I'm using the last safe version smile I'm just anxious
Posted By: Zarzal Re: Custom island happy birthday - 10/31/2007 9:02 PM
Very nice, thank you for sharing.
Posted By: Ian_W Re: Custom island happy birthday - 11/05/2007 5:01 PM
For some reason - mine has stopped working - it has been showing the same person for the last week or so frown
Posted By: blaaskaak Re: Custom island happy birthday - 11/05/2007 6:04 PM
Strange, it's still working fine here.
Posted By: sirdude Re: Custom island happy birthday - 11/05/2007 9:01 PM
works great here..

clear your cache ?
Posted By: Ian_W Re: Custom island happy birthday - 11/06/2007 3:35 AM
Uploaded the latest version - all working again.

It is a shame when 90% of users hide their birthday's.

We get threads saying 'happy birthday x' when x is not showing on the birthday list frown
Posted By: Crasher Re: Custom island happy birthday - 11/06/2007 7:33 PM
just like to add my thanks for this simple but very effective mod.
Marvellous smile
Posted By: nans Re: Custom island happy birthday - 12/31/2007 12:16 PM
I tried this, in the beginning worked fine, but after a fe days, it doesn't update anymore. Probably a caching prob, but how to avoid this?

N
Posted By: Ian_W Re: Custom island happy birthday - 12/31/2007 3:39 PM
ensure you are running the latest version and clear your cache files - then rebuild the cache from your CP.
Posted By: Bill B Birthdays don't show consistently - 01/12/2008 12:35 AM
I added the Birthday Island.. It's a big hit... But it seems to only post about one out of every 20 that show up in the Calendar. Any ideas why? I thought that if they showed in the calendar, then the permissions would allow them in the Island.

Here's the code that I used -- from this forum.
===========
Code
/* PHP CODE HERE */

$maxdaysago=10;

$temp = getdate($now);
$month = $temp["mon"];
$mday = $temp["mday"];
$year = $temp["year"];

$visitlimit=time()-60*60*24*$maxdaysago;

if (isset($config['BIRTHDAYS_IN_CALENDAR']) && $config['BIRTHDAYS_IN_CALENDAR']) {
$query = "
SELECT t1.USER_DISPLAY_NAME,t2.USER_BIRTHDAY,t1.USER_IS_UNDERAGE,t1.USER_ID,t2.USER_NAME_COLOR,t1.USER_MEMBERSHIP_LEVEL
FROM {$config['TABLE_PREFIX']}USERS as t1,
{$config['TABLE_PREFIX']}USER_PROFILE as t2,
{$config['TABLE_PREFIX']}USER_DATA as t3
WHERE t2.USER_BIRTHDAY LIKE ?
AND t1.USER_IS_BANNED != '1'
AND t2.USER_PUBLIC_BIRTHDAY = '1'
AND t3.USER_LAST_VISIT_TIME >= ?
AND t1.USER_ID = t2.USER_ID
AND t1.USER_ID = t3.USER_ID
";
$sth = $dbh -> do_placeholder_query($query,array("$month/$mday/%",$visitlimit),__LINE__,__FILE__);
$marray[0] = "";
while(list($uname,$birthday,$coppauser,$birthdayuser,$Color,$PostStatus) = $dbh -> fetch_array($sth)) {
@list($bmonth,$bday,$byear) = @split("/",$birthday);
$age = "";
if ($config['AGE_WITH_BIRTHDAYS'] && !$coppauser) {
$age = $year - $byear;
$age = " ($age)";
} // end if
$Color = trim($Color);
if ($Color)
{
$uname = "<span style=\"color:$Color;\">$uname</span>";
}
else
{
if ($PostStatus == "Administrator")
{
$uname = "<span class=\"adminname\">$uname</span>";
}
elseif ($PostStatus == "Moderator")
{
$uname = "<span class=\"modname\">$uname</span>";
}
}

$bdays .= "<a href=\"{$config['BASE_URL']}/ubbthreads.php?ubb=showprofile&User=$birthdayuser\">$uname</a>$age, ";
} // end while
} // end if
if (!$bdays)
{
$bdays="No birthdays today";
}
else
{
$bdays = substr($bdays,0,strlen($bdays)-2);
$bdays = "Happy birthday ".$bdays.".";
}
/* BODY HERE */
$body = <<<EOF
$bdays
EOF;

===========
Posted By: Ian_W Re: Birthdays don't show consistently - 01/12/2008 3:20 AM
It looks like you have $maxdaysago=10 - which would mean that only those people who have been active in the last 10 days are shown.

I have mine set to 400, to show anyone who has been online in the last year (or just over)
Posted By: blaaskaak Re: Birthdays don't show consistently - 02/09/2008 12:47 AM
Originally Posted by Ian_W
It looks like you have $maxdaysago=10 - which would mean that only those people who have been active in the last 10 days are shown.


That's indeed the secret. Also banned users are excluded.
Posted By: nans Re: Birthdays don't show consistently - 02/10/2008 2:34 PM
I used the same code, and the result is quiet weird, one user, but mentioned twice:


Happy birthday Happy birthday Alone.Alone.

(http://www.femistyle.be/ubbthreads/ubbthreads.php)
Posted By: nans Re: Birthdays don't show consistently - 02/10/2008 3:21 PM
Ignore previous mail, I didn't change anything, but now the double is gone.. :-(
Posted By: Ian_W Re: Birthdays don't show consistently - 05/09/2008 3:24 PM
If no year of birth is included by the user, then this box is showing the current year - i.e. 2008, as the age.
Posted By: Ian_W Re: Birthdays don't show consistently - 05/09/2008 3:25 PM
BTW - this is probably because the profile shows the year of birth as 0!
Posted By: blaaskaak Re: Birthdays don't show consistently - 05/10/2008 12:05 AM
Yeah, it takes the current year minus the birth year as age.

Have to update this for 7.3 anyway for usercolorcoding, will fix this too.

edit:

change line:
Code
		if ($config['AGE_WITH_BIRTHDAYS'] && !$coppauser) {

into:

Code
		if ($config['AGE_WITH_BIRTHDAYS'] && !$coppauser && $byear ) {
Posted By: Ian_W Re: Birthdays don't show consistently - 05/10/2008 12:05 PM
Thanks - let us know when you have an updated version released.
Posted By: blaaskaak Re: Birthdays don't show consistently - 05/12/2008 12:29 AM
Originally Posted by Ian_W
Thanks - let us know when you have an updated version released.


I just made an update, but permissions don't seem to be correct here yet in this subforum, I can't edit my first post.

Code
/* PHP CODE HERE */

$maxdaysago=60;

$temp = getdate($now);
$month = $temp["mon"];
$mday = $temp["mday"];
$year = $temp["year"];

$visitlimit=time()-60*60*24*$maxdaysago;

if (isset($config['BIRTHDAYS_IN_CALENDAR']) && $config['BIRTHDAYS_IN_CALENDAR']) {
$query = "
SELECT t1.USER_DISPLAY_NAME,t2.USER_BIRTHDAY,t1.USER_IS_UNDERAGE,t1.USER_ID,t2.USER_NAME_COLOR,t1.USER_MEMBERSHIP_LEVEL
FROM {$config['TABLE_PREFIX']}USERS as t1,
{$config['TABLE_PREFIX']}USER_PROFILE as t2,
{$config['TABLE_PREFIX']}USER_DATA as t3
WHERE t2.USER_BIRTHDAY LIKE ?
AND t1.USER_IS_BANNED != '1'
AND t2.USER_PUBLIC_BIRTHDAY = '1'
AND t3.USER_LAST_VISIT_TIME >= ?
AND t1.USER_ID = t2.USER_ID
AND t1.USER_ID = t3.USER_ID
";
$sth = $dbh -> do_placeholder_query($query,array("$month/$mday/%",$visitlimit),__LINE__,__FILE__);
$marray[0] = "";
while(list($uname,$birthday,$coppauser,$birthdayuser,$Color,$PostStatus) = $dbh -> fetch_array($sth)) {
@list($bmonth,$bday,$byear) = @split("/",$birthday);
$age = "";
if ($config['AGE_WITH_BIRTHDAYS'] && !$coppauser && $byear) {
$age = $year - $byear;
$age = " ($age)";
} // end if
$Color = trim($Color);
$uname = $html->user_color($uname, $Color, $PostStatus);
$bdays .= "<a href=\"{$config['BASE_URL']}/ubbthreads.php?ubb=showprofile&User=$birthdayuser\">$uname</a>$age, ";
} // end while
} // end if
if (!$bdays)
{
$bdays="No birthdays today";
}
else
{
$bdays = substr($bdays,0,strlen($bdays)-2);
$bdays = "Happy birthday ".$bdays.".";
}
/* BODY HERE */
$body = <<<EOF
$bdays
EOF;

This is the latest/greatest for 7.3.
Posted By: Gizmo Re: Birthdays don't show consistently - 05/12/2008 12:50 AM
BTW, it'd be good to have seperate UBB7.3 and Pre7.3 versions listed wink...
Posted By: blaaskaak Re: Birthdays don't show consistently - 05/12/2008 1:26 AM
Originally Posted by Gizmo
BTW, it'd be good to have seperate UBB7.3 and Pre7.3 versions listed wink...


It be even better if I were able do to just that in post #1 smile
Posted By: Ian_W Re: Birthdays don't show consistently - 05/12/2008 8:29 AM
I have added the 7.3 version to the first post smile

Let me know if you would like the other version removed or updated.
Posted By: jgeoff Re: Birthdays don't show consistently - 05/12/2008 8:31 AM

But it never stopped working, at least for me... any major change?
Posted By: blaaskaak Re: Birthdays don't show consistently - 05/12/2008 9:43 AM
Originally Posted by jgeoff

But it never stopped working, at least for me... any major change?


Username color coding is added for 7.3, because you also have global mods in it with their own color. And a bug is fixed that Ian mentioned, if a user has no birthyear filled in in their profile, the age was wrong.
Posted By: jgeoff Re: Birthdays don't show consistently - 05/16/2008 7:34 AM

Gotcha - point taken! cool
Posted By: blaaskaak Re: Birthdays don't show consistently - 05/16/2008 10:32 AM
Originally Posted by jgeoff

Gotcha - point taken! cool


Updated code also? wink
Posted By: willing Re: Custom island happy birthday - 05/31/2008 4:10 AM
Nice one.

Is there a way to "offset time".

So for example if we are in Japan then "today" is today as it is in Japan? Right now I have 2 birthdays for today, but they did not show up (even though they were active members).

Thanks
Posted By: blaaskaak Re: Custom island happy birthday - 06/01/2008 12:29 PM
Since this is all cached stuff, doing timezones per user is a bit difficult. Everything now has to be based on servertime.

would be cool if a cached version would be created per timezone.
Posted By: willing Re: Custom island happy birthday - 06/01/2008 12:46 PM
I wasn't asking for "per user", but to be "set" to the timeozone for all users.

(Our server is not based in the same time zone as where we are and where I want it set for and when I tried the above it semeingly was using the server time).

Thanks
Posted By: blaaskaak Re: Custom island happy birthday - 06/01/2008 11:14 PM
Okay, I need to take the server offset time into considiration. Never throught of that one.
Posted By: blaaskaak Re: Custom island happy birthday - 06/01/2008 11:32 PM
okay, just before:

PHP Code

$temp
= getdate($now);


add
PHP Code

$now
= time()+($config['SERVER_TIME_OFFSET']*60*60);


Should work, not tested yet since I don't have an install at hand where I can easely test this. Will test this and update the first post.
© UBB.Developers