Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Owain on December 20, 2005, 10:48:29 AM

Title: Todays birthday
Post by: Owain on December 20, 2005, 10:48:29 AM
Is there any way to get the upcoming birthday to change to read "Todays birthday" for people who have birthdays on that day?

Cheers,

O.

Title: Re: Todays birthday
Post by: Oldiesmann on December 20, 2005, 11:13:16 AM
Did you want to separate "today's birthdays" from the upcoming birthdays or do you have the calendar set to only display events from the current day?
Title: Re: Todays birthday
Post by: Owain on December 20, 2005, 12:55:16 PM
I would like to seperate the upcoming events from todays events. Is this possible?

i.e.

Todays Events: Owain's Birthday
Upcoming Events: Christmas Day

Title: Re: Todays birthday
Post by: Oldiesmann on December 20, 2005, 01:00:09 PM
Do you want it to look like this:

Today's Birthdays: Owain (age), othermember (age), ...
Upcoming Birthdays: Member1 (age), Member2 (age), ...
Upcoming Events: Christmas Day

or this:

Today's Birthdays: Owain (age), othermember (age), ...
Upcoming Events: Christmas Day

SMF already seperates birthdays and events, so it's just a matter of seperating today's birthdays from upcoming ones (which is relatively easy to accomplish).
Title: Re: Todays birthday
Post by: Owain on December 20, 2005, 01:08:00 PM
erm, so many options :)

I guess it would be good to have Today's Birthdays: Owain (age), othermembers(age),......
Upcoming Birthdays: Blah(age)
Upcoming Events: Christmas

Cheers,

O.
Title: Re: Todays birthday
Post by: SleePy on December 21, 2005, 03:26:37 PM
Weres the code for this? im interested on how to do this for my forums.
Title: Re: Todays birthday
Post by: Owain on December 22, 2005, 03:41:21 AM
Ye, Im really interested in getting this on my forum as well.....

O.
Title: Re: Todays birthday
Post by: Owain on December 28, 2005, 05:32:45 PM
How do you do this??????? You tease us by saying it can be done and then don't tell us how!

O.
Title: Re: Todays birthday
Post by: Owain on January 01, 2006, 06:38:13 AM
Can it be done???

O.
Title: Re: Todays birthday
Post by: Oldiesmann on January 01, 2006, 03:13:21 PM
Sorry for the lack of response. I was out of town most of last week (starting last Wednesday) and just got back earlier today. I'm really tired right now, but I will take a look at it tomorrow when I'm not as tired.
Title: Re: Todays birthday
Post by: Owain on January 04, 2006, 04:13:15 PM
Excellent :) Thanks....

O.
Title: Re: Todays birthday
Post by: Owain on January 06, 2006, 07:10:36 AM
sorry to keep asking but I have a birthday coming up tomorrow and I would like to test the code by then :)

O.
Title: Re: Todays birthday
Post by: EG on January 06, 2006, 08:55:47 AM
the quick fix is to put the number of days to display ahead as -1

it works, even tho its wierd!
Title: Re: Todays birthday
Post by: Owain on January 06, 2006, 09:12:52 AM
I guess that only works for the day the event happens?

I would like to have it show, upcoming events and birthdays but also show "Todays Events and Birthdays"

O.
Title: Re: Todays birthday
Post by: Owain on January 10, 2006, 07:57:42 AM
Any help with this?

O.
Title: Re: Todays birthday
Post by: geezmo on May 06, 2006, 03:59:32 PM
Hmm this thread died. I need to change my codes too so if anyone can help here, that'd be great.
Title: Re: Todays birthday
Post by: my evil twin on August 25, 2006, 06:23:14 AM
damn... i need that function and nobody answers  >:(
Title: Re: Todays birthday
Post by: chrishicks on October 01, 2007, 01:29:50 PM
I'd also like to have this change on my board. one of my members birthdays is today yet he's still listed as upcoming.
Title: Re: Todays birthday
Post by: metallica48423 on October 30, 2007, 02:29:11 AM
is this resolved or do you still require assistance? 

If i remember correctly, today's events are bolded?

I might have to grab Oldiesmann to look at this, though.
Title: Re: Todays birthday
Post by: Owain on October 30, 2007, 03:50:31 AM
Hi!
Nope, its not resolved. I would still like to have Today's Birthdays and Today's Events shown and below them Upcoming Birthdays and Upcoming Events....will this be possible?

Cheers,
O.
Title: Re: Todays birthday
Post by: metallica48423 on October 30, 2007, 04:09:48 AM
this thread has been active forever and a day lol..

I'll look tomorrow (i've marked this thread unread to remind me)  BUt i'll also notify oldiesmann
Title: Re: Todays birthday
Post by: Owain on October 30, 2007, 05:42:52 AM
If we wait until December then it will be 2 years since I made the first request :) 

All good things come to those who wait!!

Looks forward to hopefully behing able to mod my forum to do this.

O.
Title: Re: Todays birthday
Post by: metallica48423 on October 30, 2007, 01:18:57 PM
i could always lock it until then ;)

Sent a message to oldiesmann -- took a look but can't quite get it -- interested in learning to do this though for the future
Title: Re: Todays birthday
Post by: Owain on October 30, 2007, 07:10:24 PM
Ive actually just started programming PHP and I may have a look in to this myself. Will let you know how I get on.

I would imagine its just a case of querying the database and setting different conditions depending on whether the date in the calander matches the current date.

O.
Title: Re: Todays birthday
Post by: metallica48423 on October 30, 2007, 11:12:38 PM
It may be as simple as checking a variable ;)

Remember, today's events are bolded, meaning that it has a way to check that something is today's event ;)
Title: Re: Todays birthday
Post by: Owain on November 21, 2007, 03:18:29 AM
Has anyone else had a chance to look at this?

Not had time myself :(

O.
Title: Re: Todays birthday
Post by: Dragooon on November 21, 2007, 03:23:26 AM
I am gonna say this again but something like this?
Todays Birthday : Bla
Upcoming Birthdays : Again blah
Upcoming events : And again blah
If I get you right?
Title: Re: Todays birthday
Post by: Owain on November 21, 2007, 04:39:43 AM
Or :

Todays Birthdays:
Todays Events:

Upcoming Birthdays:
Upcoming Events:

:)

O.
Title: Re: Todays birthday
Post by: Owain on November 22, 2007, 09:38:38 AM
Any luck with this?

I might actually have time to look in to this myself tonight! How annoying it would be if I manage to do it tonight just by digging about a bit in the code :D

O.
Title: Re: Todays birthday
Post by: capabmx on November 22, 2007, 10:07:36 AM
Since, nobody seems to have gotten anywhere thus far, here is what I've found at the moment.

You might want to first go to themes/default/languages/index.english.php

find $txt['calendar3b'] = 'Upcoming Birthdays:';
$txt['calendar4b'] = 'Upcoming Events:';


add after $txt['calendar3c'] = 'Todays Birthdays:';
@txt['calendar4c'] = Today's Event's:';


Ok, give me a sec yet, I'm still trying to work out getting it to show on the forum index.
Title: Re: Todays birthday
Post by: capabmx on November 22, 2007, 10:16:34 AM
Ok, if maybe someone could tell me exactly which file has the table that shows upcoming events, because all you have to do is add a table named Today's events beneath it and I think insert this
if (!empty($context['calendar_birthdays']))
{
echo '
<span style="color: #', $modSettings['cal_bdaycolor'], ';">', $context['calendar_only_today'] ? $txt['calendar3'] : $txt['calendar3b'], '</span> ';
/* Each member in calendar_birthdays has:
id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
foreach ($context['calendar_birthdays'] as $member)
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<b>' : '', $member['name'], $member['is_today'] ? '</b>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';
}
// Events like community get-togethers.
if (!empty($context['calendar_events']))
{
echo '
I'm not sure though, because I'm still trying to figure it out, from the code, it almost looks like it is meant to show Today's Birthdays as Today's and not upcoming so now I'm confused.
Title: Re: Todays birthday
Post by: metallica48423 on November 22, 2007, 01:01:04 PM
todays is shown in bold. they are just not physically separated. it should be boardindex.template.php
Title: Re: Todays birthday
Post by: Owain on November 23, 2007, 04:30:22 AM
As always, I didnt get a chance to look in to this last night!

Its good to see some code snippets on the thread though, I think I can see a light at the end of the tunnel.....either that or its a train!!!

O.
Title: Re: Todays birthday
Post by: Owain on November 27, 2007, 05:16:53 AM
Any more progress??

Just trying to keep this thread alive as I don't want to wait another 2 years for a solution :)

O.
Title: Re: Todays birthday
Post by: capabmx on November 28, 2007, 09:02:03 AM
Sorry :), just got finished moving into a new house, I'll get right on this again.
Title: Re: Todays birthday
Post by: Owain on November 29, 2007, 04:20:40 AM
Thanks! That would be great :) I had a look but don't have the time to work it all out just now.....

O.
Title: Re: Todays birthday
Post by: Bulakbol on November 29, 2007, 06:45:39 PM
Sorry, I tried it but too buggy hehe. You can try it. Improve it or play with it. BoardIndex.template.php


// People's birthdays.  Like mine.  And yours, I guess.  Kidding.
if (!empty($context['calendar_birthdays']))
{
echo '
<span style="color: #', $modSettings['cal_bdaycolor'], ';">';
/* Each member in calendar_birthdays has:
id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
$brokendown = array
(
'now' => array(),
'soon' => array(),
);
$celebnow = 0; // celebrant counter
$celebsoon = 0;
foreach ($context['calendar_birthdays'] as $key => $member)
if ($member['is_today']) // birthday today
{
$brokendown['now'][] = &$context['calendar_birthdays'][$key];
$celebnow++;
}
else // birthday soon
{
$brokendown['soon'][] = &$context['calendar_birthdays'][$key];
$celebsoon++;
}
// Any birthday celebrant today?
if ($celebnow > 0)
{
echo 'Today\'s ', $txt['calendar3'], ' ';
foreach ($brokendown['now'] as $broken)
{
echo '<a href="', $scripturl, '?action=profile;u=', $broken['id'], '">';
if (!empty($broken['color']))
echo '<span style="color: ', $broken['color'], '"><strong>', $broken['name'], '</strong>';
else
echo '<span style="color: #', $modSettings['cal_holidaycolor'], ';"><strong>', $broken['name'], '</strong>';
echo isset($broken['age']) ? '(' . $broken['age'] . ')' : '', '</a>', !$broken['is_last'] ? ', ' : '';
}
echo '</span><br />';
}
// upcoming birthdays
if ($celebsoon > 0)
{
echo $txt['calendar3b'], ' ';
foreach ($brokendown['soon'] as $broken)
{
echo '<a href="', $scripturl, '?action=profile;u=', $broken['id'], '">';
if (!empty($broken['color']))
echo '<span style="color: ', $broken['color'], '">', $broken['name'];
else
echo '<span style="color: #', $modSettings['cal_holidaycolor'], ';">', $broken['name'];
  echo isset($broken['age']) ? '(' . $broken['age'] . ')' : '', '</a>', !$broken['is_last'] ? ', ' : '';
}  
echo '</span><br />';
}
echo '</span>';
}

// Events like community get-togethers.
Title: Re: Todays birthday
Post by: Owain on November 30, 2007, 07:37:23 AM
That's great. I might try and edit it so it shows another section saying "Today's Events" but apart from that its been worth the 2 year wait :)

If anyone else has another version please do post it as it will help others.

O.
Title: Re: Todays birthday
Post by: Bulakbol on November 30, 2007, 02:22:35 PM
Quote from: Owain on November 30, 2007, 07:37:23 AM
That's great. I might try and edit it so it shows another section saying "Today's Events" but apart from that its been worth the 2 year wait :)

If anyone else has another version please do post it as it will help others.

O.

2 years? lol. It's not that important I guess that's why no one bothers to try it.

<EDIT>

Here's bug-free.


// People's birthdays.  Like mine.  And yours, I guess.  Kidding.
if (!empty($context['calendar_birthdays']))
{
/* Each member in calendar_birthdays has:
id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
$brokendown = array
(
'now' => array(),
'soon' => array(),
);
$celebnow = 0; // celebrant counter
$celebsoon = 0;
foreach ($context['calendar_birthdays'] as $key => $member)
if ($member['is_today']) // birthday today
{
$brokendown['now'][] = &$context['calendar_birthdays'][$key];
$celebnow++;
}
else // birthday soon
{
$brokendown['soon'][] = &$context['calendar_birthdays'][$key];
$celebsoon++;
}
// Any birthday celebrant today?
if ($celebnow)
{
echo '
<span style="color: #', $modSettings['cal_bdaycolor'], ';">Today\'s ', $txt['calendar3'], ' ';
foreach ($brokendown['now'] as $broken)
{
$celebnow--;
echo '<a href="', $scripturl, '?action=profile;u=', $broken['id'], '">';
if (isset($broken['color']))
echo '<span style="color: ', $broken['color'], ';"><strong>', $broken['name'], '</strong>';
else
echo '<span><strong>', $broken['name'], '</strong>';
echo isset($broken['age']) ? '(' . $broken['age'] . ')' : '', '</a>', $celebnow ? ', ' : '';
}
echo '</span><br />';
}
// upcoming birthdays
if ($celebsoon)
{
echo '<span style="color: #', $modSettings['cal_bdaycolor'], ';">', $txt['calendar3b'], ' ';
foreach ($brokendown['soon'] as $broken)
{
$celebsoon--;
echo '<a href="', $scripturl, '?action=profile;u=', $broken['id'], '">';
if (isset($broken['color']))
echo '<span style="color: ', $broken['color'], ';">', $broken['name'];
else
echo '<span>', $broken['name'];
  echo isset($broken['age']) ? '(' . $broken['age'] . ')' : '', '</a>', !$broken['is_last'] ? ', ' : '';
}  
echo '</span><br />';
}
}

// Events like community get-togethers.


</EDIT>
Title: Re: Todays birthday
Post by: metallica48423 on December 15, 2007, 09:33:16 PM
Did that one work for you?