Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Joined: Aug 2002
Posts: 111
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 111
Okay -- I added a cute little graphic and also changed the font colour, as my page background is black and the greeting wasn't showing up otherwise.

Two other questions, if you don't mind --

1. I use the table wrappers mod, and the birthday announcement "sits" on top of the wrapper (there's no space between the table and the greeting). How can I put a line of space below the greeting to improve the look?

2. Can this hack be modified so I can display birthday information to *every* user (so a birthday is announced to everyone on the board)? I have a small private community of just a few users, so I need to make individual birthday announcements regardless. Having the hack make the announcement for me would sure save me some time.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, I've modified that like that at thesoulelement.com

I'll put the code together tonight.

Joined: Aug 2002
Posts: 111
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 111
[]Yeah, I've modified that like that at thesoulelement.com

I'll put the code together tonight. [/]

Yay! No free time for Josh when I'm around

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
He he... yeah, you got lots of little projects for me.

OK - change the bottom bit of the bday mod in ubbthreads.php to this:

Code
<br />Yikes.  That sucks. :p<br />Your site here is so pretty.  Really.<br />Very sharp with the boraders and the black background<br />And the cool red logo. ;)<br /><br />OK - change the bday mod code in ubbthreads.php to this:<br />[code]<br />		if ($Today != 0) {<br />			$todaybday .= "<br />";<br />		}	<br />	}<br />   list($tbopen,$tbclose) = $html -> table_wrapper();<br />	if (($UserBirthDay == $today) && ($UserBirthMonth == $thismonth)) {<br />		$BirthdayGreeting = "$tbopen <tr><td class=\"lighttable\"><div align=\"center\"><b><font size=\"+2\">Happy Birthday $Username!!</font></b></div></td></tr>$tbclose";<br />	}<br />	if (($Username) && ((!$UserBirthDay) || (!$UserBirthMonth))) {<br />		$BirthdayWarning = "<div align=\"center\"><b><a href=\"{$config['phpurl']}/editbasic.php?Cat=$Cat\">Click Here</a> to Update your Birtday Information in Your Profile!</b></div>";<br />	}<br />	if ($Today) {<br />		$TodayTopBday = "$tbopen <tr><td class=\"lighttable\"><div align=\"center\"><b>$TodayIntro</b> $todaybday</div></td></tr>$tbclose";<br />	}<br /><br />// ------End of Profile Birthday Hack



Then add this:

$TodayTopBday

into the ubbthreads.tmpl file... at the top.. above or below the $BirthdayGreeting

$BirthdayGreeting will be the greeting that the user gets on their birthday. You could customize it with images etc....

$TodayTopBday will be a box at the top, listing "today's birthdays".

Hope that helps.

Joined: Dec 2002
Posts: 173
Member
Member
Offline
Joined: Dec 2002
Posts: 173
Hi Nikos

I have a prob with the birhtdays in the profile page.

This is what happens..........

When I insert the bithday in the profile and click submit,
the bithday goes in the calendar okay but if I return to
the profile page it is missing, nothing drastic I suppose
just annoying.

What I have done.................

1. Checked for
$Birthmonth = get_input("Birthmonth","post");
$Birthday = get_input("Birthday","post");
$Birthyear = get_input("Birthyear","post");


These lines are present.

2. Placed this
print "$query";
in the changebasic.php

Print shows everything Okay dates are in place
U_BirthMonth = '5', U_BirthDay = '5', U_BirthYear = '1955'

So apart from them not showing in the profile all looks okay.

Any ideas?

Thanks


Thanks

Liahona
Sponsored Links
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I can see a potential problem there without checking anything else. The U_BirthMonth stores data as text and not numbers. So in your example it should have been
U_BirthMonth='May',.... and not
U_BirthMonth='5'

Can you please check that part? If you are stuck email me and we can have a look at the code closely.

Warm regards

Nikos


Nikos
Joined: Dec 2002
Posts: 173
Member
Member
Offline
Joined: Dec 2002
Posts: 173
Hi Nikos

Sorry, my mistake, to much of a rush.....

Here is the line....

U_BirthMonth = 'Jun', U_BirthDay = '5', U_BirthYear = '1953' WHERE U_Number = '2'

Sorry


Thanks

Liahona
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I will check your forum tomorrow morning George and let you know via pm.

Nikos


Nikos
Joined: Jan 2001
Posts: 374
Enthusiast
Enthusiast
Offline
Joined: Jan 2001
Posts: 374
Actually: storing months as Numbers would not be such a bad idea:
That would open new possibilities to easily add language files with month names in individual languages....

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
I'd suggest to store the birthday in a mysql date-field.
YYYY-MM-DD is the format.
Advantages:
- 1 field instead of 3
- language independend
- mysql can perform calculations with dates
- to get all today's birthday you could simply perform a Select * from table where U_Birthday like '2003-02-".$today';
- i do it that way

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I agree... what I wasn't sure at the time, was how to extract just birthday's from a particular month.

You see... some of my users didn't mind giving the whole birthday (month, day & year).... others just gave month and day, and some would only give Month.

I know alot more now, from when I originally made this, so it's probably due for a rewrite using a date field.

Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
Yes, you are right. Some users don't want their age to be displayed.
I created an optional field where they can choose, weather day & month or day & month & year should be displayed.

Sure, a rewrite would improve the data handling. But your idea was really great, i must say.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
It's pretty popular... and it's funny.... it's popped up on several Boards I visisted.... and it works.... I got lots of PMs on my birthday on various boards.

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I think we can get rid of the problem with the year, by setting it to the first year that the epoch time allows or something like 1900. I don't think that if I were 103 I would post in any forum....


Nikos
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I have updated this post with a new birthday pal box. I noticed at a few sites I visited, that there's been a bit of a tablewrapper change and it wasn't looking right everywhere.

Coy7 - you should replace yours. This will make the lighttable/darktable thing work right.


Last edited by JoshPet; 02/11/2003 12:15 AM.
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I don't know if anyone has seen this or it has been mentioned on this thread (heck I am really tired now) but for some users I kept on getting a mktime error at the top of the showprofile screen. The reason was the epoch time and the users inputting their year of birth to numbers less than 1970. A simple workaround will sort this.

Open showprofile.php
Find:
Code
<br />	if (($Birthmonth) && ($BirthDay) && ($BirthYear)) <br />	{<br />		$epochbday = mktime (0,0,0,$Birthmonth,$BirthDay,$BirthYear);<br />		$currentday = time();<br />		$epochage = $currentday - $epochbday;<br />		$age = intval($epochage / 31536000);<br />

and change it to this:
Code
<br />	if (($Birthmonth) && ($BirthDay) && ($BirthYear)) <br />	{<br />		if ( $BirthYear < 1970 )<br />		{<br />			$DatePlus	=	1970 - $BirthYear;<br />			$BirthYear	=	1970;<br />		}<br />		else <br />		{<br />			$DatePlus	=	0;<br />		}<br />		<br />		$epochbday = mktime (0,0,0,$Birthmonth,$BirthDay,$BirthYear);<br />		$currentday = time();<br />		$epochage = $currentday - $epochbday;<br />		$age = intval($epochage / 31536000) + $DatePlus;<br />


Nikos
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Ack... does that make the age work right.

JustDave worked forever on a fix which I haven't posted here yet.... getting the the age calculation to be accurate on dates before 1970.

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
That one works like a charm. Basically if the date is earlier than 1970 it keeps the difference in years and sets it to 1970. The following calculations will sort out how old you are with the epoch day and all you have to do then is add how many years you have between the actual year and 1970.

This actually started showing an Argentinian friend of mine 33 years old whereas he was 38. Needless to say that none of the girls in the forum complained about this....



Nikos
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Doah..... that looks a lot easier than the route JustDave helped me figure out.

Thanks for the fix... I'll update these zips one of these evenings.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I've updated the main post of this thread to version 1.5.

Ver. 1.5 is a bug fix for the showprofile age calculation bug. Thanks to Dimopoulos and JustDave for help in tracking this down.


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
he he

There's a bunch of women at one of my sites very mad at me for fixing thier ages. They "LOVED" being 33 again.

She writes:
[]JOSH my CyberDaddy!! For gawds sake! Who gave you the brite idea that I wanted to be more than 33? I got a b-d coming up. It won't belong long before I'll be twice the glitch. But Man I can still climb the rocks and hills. I still really enjoy life though.[/]

Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
LMAO Josh! CyberDaddy???? LOL LOL


Nikos
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
LOL
That's what they call me there.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Birthday Cron

OK - This is an AddOn if you are using the Birthday Mod.
It can do two things. It can send people a PM on their birthday, and it can make a post in a forum of your choice announcing "today's birthdays". This gives your members a place to reply with their well wishes.
It is fully configurable. You can choose to have it just do the PMs, or Just make the posts, or both. You can control what user number the PMs or Posts come from. You can also edit the content of the PMs and Post.

Commissioned by Coy7.

Instructions: Drop this script into your threads directory, and set up a cron job to run it once a day. Edit the variables at the top of the file to customize the options. Enjoy!

Edit: Updated so that it doesn't make a post when there are no birthdays. Thanks Racantaeur
Attachments
73911-birthdaycron.zip (0 Bytes, 38 downloads)

Last edited by JoshPet; 04/11/2003 12:06 AM.
Joined: Aug 2002
Posts: 111
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 111
I asked Josh to design this mod for me because I run a forum mainly inhabited by teenagers, and they love little features that make them feel special, (like the original birthday mod). I'd developed a sense of obligation over the birthday mod, though -- every day on my board I'd see half a dozen users having a birthday, and I felt like I should send them all a personalized greeting from "the board Mom". This new Cron Addon of Josh's alleviates my guilt entirely. I write a generic birthday greeting, put a cute little icon in the message, and it's automatically sent to every birthday guy or gal from my username. It makes me seem like a nice person but lets me be lazy about it, too. Great work Josh!

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
yeah, great idea and nice work Josh thumbsup


- Allen wavey
- What Drives You?
Joined: Aug 2002
Posts: 218
Member
Member
Offline
Joined: Aug 2002
Posts: 218
Hi Josh,

I think I found a small cosmetic bug.
The user is able to set his birthday in his profile but an admin is not.

I tried to do it for someone cause he was to stupid to find the entries but I can't see it also. The I used the 'become this user' option to become him and set it.

Try yourself. Search for a user and click on 'edit profile' and you will not see the field to enter his birthday.

How can I also add it to the admin view?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, I never included that just to minimize the number of scripts modified and make upgrades easier.

You'd have to also modify /admin/showoneuser.php and /admin/dochangeuser.php

But I figured the admin would never normally need to enter this info... as they wouldn't normally know a users birthday. For the occational eejit who can't figure it out... you could become this user or do it very quickly with an SQL command.

The client who paid me to write it didn't care about the admin's ability to edit birthdays. But if you want... feel free.

Joined: Aug 2002
Posts: 218
Member
Member
Offline
Joined: Aug 2002
Posts: 218
[]JoshPet said:
Birthday Cron

OK - This is an AddOn if you are using the Birthday Mod.
It can do two things. It can send people a PM on their birthday, and it can make a post in a forum of your choice announcing "today's birthdays". This gives your members a place to reply with their well wishes.
It is fully configurable. You can choose to have it just do the PMs, or Just make the posts, or both. You can control what user number the PMs or Posts come from. You can also edit the content of the PMs and Post.

Commissioned by Coy7.

Instructions: Drop this script into your threads directory, and set up a cron job to run it once a day. Edit the variables at the top of the file to customize the options. Enjoy! [/]

One thing Josh. I am using the cron to write a PM AND a forum entry. Its working fine with one exception.
Its making also a forum entry if there is no one who has birthday.

Can you change the script in this way that its not posting a thread if they are no birthdays?

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Hi Coy7,

Would you mind posting your cron job??? Is it PHP or Perl? I have never done this before and am curious. Looked at the doexpire.php and subscriptions.php scripts, which make some sense, but am not sure how they are getting invoked and what sorts of return values are expected.

I think I misread Josh's post... is it true that I just need to have my host setup a cron job that points to the birthdaycron.php script and it will fire off??

Cheers,

Chris


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yes, most likely if you are on shared hosting, ask your host to set up a cron job to fire it off once a day.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
he he

Just finally had a a day without a bday on my board and discovered that. I'll tune that up shortly.

Joined: Aug 2002
Posts: 111
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 111
[]Raconteur said:
Hi Coy7,

Would you mind posting your cron job??? Is it PHP or Perl? I have never done this before and am curious. Looked at the doexpire.php and subscriptions.php scripts, which make some sense, but am not sure how they are getting invoked and what sorts of return values are expected.

I think I misread Josh's post... is it true that I just need to have my host setup a cron job that points to the birthdaycron.php script and it will fire off??

Cheers,

Chris [/]

I'll freely admit that Josh set up my cron tasks for me because I'd looked at them and felt out of my league. He also provided the wording for sending to my hosting company (I posted about that it this thread: https://ubbdev.com/threads/php/...view=collapsed&sb=5&o=&vc=1)

So, I guess I'll leave Josh to answer exactly which files need to be modified because I'm not sure, and cuz he's up and no one else is here so maybe he's bored

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
he he

Yeah, your host didn't allow us access to do that on our own. They had to set it up. But basically we sent them the paths to the scripts that needed to run.

On my server, I have a webmin control panel... and I schedule the task like this:

/usr/bin/php /home/measurection/htdocs/forums/birthdaycron.php


Some info on setting up cron jobs can be found here;
http://www.ubbcentral.com/resources/cron.html

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Cool. Thanks.

Josh, I have the fix for that bug if you want it.


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Sure... I haven't had a chance to look at it. If you post it, I'll update the file.

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Here it is. Simple add of an if statement at line 169.

Not sure if it works correctly since I have not gotten the cron task setup... but it looks pretty straightforward.

I also reformatted. You had your CR/LFs set to Mac and the file was getting hammered on upload.
Attachments
75139-birthdaycron.zip (0 Bytes, 19 downloads)


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Raconteur this inserted in the cron file will run it at 2 am every morning replace with your path of course


0 2 * * * /usr/local/apache/htdocs/ubbthreads/cron/php/birthdaycron.php

Joined: Jan 2003
Posts: 250
Member
Member
Offline
Joined: Jan 2003
Posts: 250
Thanks, Chuck, but I do not have access to it... the host is setting it up.


"Some dream of doing great things, while others stay awake and get on with it."
      -- Anonymous
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Yeah and they is two telnet command to load the file.

I am glad to do my own as when I had a server that they did it it took ages( a few days ). Since then I have been working on patience.

Page 3 of 4 1 2 3 4

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)