 |
 |
 |
 |
#315780 - 09/22/07 08:31 PM
Re: Custom island happy birthday
[Re: blaaskaak]
|
Member
Registered: 02/25/07
Posts: 286
Loc: The Netherlands
Add to del.icio.us
Digg it
|
Nice comfy bed could wait...
/* 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 Untested that is  Cleanup for post #1 I will still do tomorrow  Update: Hmm, doesn't seem to work yet, I'll have a test drive tomorrow  Don't know if the $VERSION variable is available in a custom island.
Edited by blaaskaak (09/22/07 08:39 PM)
_________________________
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#316600 - 01/11/08 04:35 PM
Birthdays don't show consistently
|
Newbie
Registered: 12/23/01
Posts: 24
Loc: Issaquah, WA
|
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. =========== /* 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; ===========
_________________________
Bill Barker Issaquah, Wa
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|