TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 385
  • Total: 385

Looking for Birthday Code

Started by qwe3, March 17, 2006, 05:59:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jpark

hi, i added this snippet and nothing looks different.  could you explain what this snippet is supposed to do?  thanks!

ontap

Quote from: jpark on May 08, 2006, 01:50:48 AM
hi, i added this snippet and nothing looks different.  could you explain what this snippet is supposed to do?  thanks!

on the userblock where it says "hey, jpark"..
it will change "Happy Birthday jpark" on the day of your birthday.

jpark


Vinspire

Any screenshot of this block ?

Thanks a bunch ! :)

guvenck

I also installed the block and set Calendar settings to 30 days. In this case, all the birthdays within a 30-days window are displayed. But I'd like to display the birthdays for the current month e.g. August. How can I do this?

JPDeni

#15
Knowing that there will be more tweaks asked for  ;)....

Put the following in a phpbox:
global $db_prefix, $scripturl;

$title = date('F') . ' Birthdays';
echo '
<div class="tborder" style="margin-bottom: 5px;">
  <div class="catbg2" style="padding: 4px; font-weight: bold;">';
echo $title;
echo '
  </div>
  <div class="windowbg" style="padding: 4px; ">';
      $month_number = '-' . date('m') . '-';
      $query = db_query(
    "SELECT ID_MEMBER, memberName
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
          AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    while ($row = mysql_fetch_assoc($query))
    {
      echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['memberName'] . '</a><br />';
    }
}
else
  echo 'No birthdays this month';
echo'  </div>
</div> ';

For it to look best set
Do not use title/frame
and
Do not allow block to collapse

This gives all the members with birthdays within the current month and lists them in alphabetical order by the member name.

guvenck

Great, this works nice, thanks for your help.

QuoteKnowing that there will be more tweaks asked for  Wink....

You know that I'd ask how to display the birthdates rather than the age near member name, don't you?

JPDeni

How do you want it? Something like:

Curly -- 8
Eloise -- 25
Fred -- 5
Larry -- 3
Moe -- 5
Wilma -- 10

or more like

3 -- Larry
5 -- Fred
5 -- Moe
8 -- Curly
10 -- Wilma
25 -- Eloise

The first one's easier but I think I can do the second. It all comes in the sorting.

guvenck

I'd prefer this format:

Apollo (08.08)
Starbuck (12.08)
Adama (23.08)
Boomer (24.08)

Just add an "ORDER BY day ASC" to your query, then a while loop should do the job :)

JPDeni

Not exactly. The way the database is set up, the birthdate is in the format of yyyy-mm-dd, so if I order by birthdate, I'll get them ordered by the year they were born, not the day. It'll take a little more to order by day. I'll go play around with it for a bit.

This website is proudly hosted on Crocweb Cloud Website Hosting.