News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Todays birthday

Started by Owain, December 20, 2005, 10:48:29 AM

Previous topic - Next topic

Owain

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.

www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Oldiesmann

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?
Michael Eshom
Christian Metal Fans

Owain

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

www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Oldiesmann

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).
Michael Eshom
Christian Metal Fans

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

SleePy

Weres the code for this? im interested on how to do this for my forums.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Owain

Ye, Im really interested in getting this on my forum as well.....

O.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Owain

How do you do this??????? You tease us by saying it can be done and then don't tell us how!

O.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Owain

www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Oldiesmann

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.
Michael Eshom
Christian Metal Fans

Owain

www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Owain

sorry to keep asking but I have a birthday coming up tomorrow and I would like to test the code by then :)

O.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

EG

the quick fix is to put the number of days to display ahead as -1

it works, even tho its wierd!

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Owain

www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

geezmo

Hmm this thread died. I need to change my codes too so if anyone can help here, that'd be great.

my evil twin

damn... i need that function and nobody answers  >:(

chrishicks

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.

metallica48423

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.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

metallica48423

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
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

metallica48423

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
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

metallica48423

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 ;)
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Owain

Has anyone else had a chance to look at this?

Not had time myself :(

O.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Dragooon

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?

Owain

Or :

Todays Birthdays:
Todays Events:

Upcoming Birthdays:
Upcoming Events:

:)

O.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

capabmx

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.
Always looking to take on a web design/ programming job :], PM me if interested.

capabmx

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.
Always looking to take on a web design/ programming job :], PM me if interested.

metallica48423

todays is shown in bold. they are just not physically separated. it should be boardindex.template.php
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Owain

Any more progress??

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

O.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

capabmx

Sorry :), just got finished moving into a new house, I'll get right on this again.
Always looking to take on a web design/ programming job :], PM me if interested.

Owain

Thanks! That would be great :) I had a look but don't have the time to work it all out just now.....

O.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Bulakbol

#36
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.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Owain

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.
www.tractionkiting.co.uk
Dedicated to promoting Kiting in Scotland

Bulakbol

#38
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>
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

metallica48423

Did that one work for you?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Advertisement: