1
Monika
Profile module date bug, request fix
  • 2009/2/16 11:49

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


Hi guys
There is a bug in profile module, it doesn't save the date correctly!

To make it clear, I have created a new field in User Profile, field type: DATE.

I made it required in registration form.

The problem is when someone wants to register, he choose his birthday DATE, but it is not saved during registration!!

He has to go back to his profile and edit the DATE again!! then it will be saved correctly.

Why? and how to fix this?

Anyone of you can test this, it only takes 2 minutes.

Please help, many thanks in advance.

2
Anonymous
Re: Profile module date bug, request fix
  • 2009/2/21 0:20

  • Anonymous

  • Posts: 0

  • Since:


localhost or online ?

Windows does not support date functions in php files.

3
Monika
Re: Profile module date bug, request fix
  • 2009/2/21 1:03

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


both, tested on linux real server.

4
Catzwolf
Re: Profile module date bug, request fix
  • 2009/3/8 2:24

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


examples of usage that fails to work please?

5
Monika
Re: Profile module date bug, request fix
  • 2009/3/15 2:15

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


Quote:
examples of usage that fails to work please?

Hi sir, please just read my first post carefully, then you will understand me.

Usage : adding a new field (DATE) in profile.

The bug: It will always show the default date whatever the date the memeber chose during his registration.

I hope this is clear

6
Catzwolf
Re: Profile module date bug, request fix
  • 2009/3/15 13:25

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Thanks, We just needed to know if this was just the registration or it happened elsewhere.

Catz

7
Monika
Re: Profile module date bug, request fix
  • 2009/3/19 18:22

  • Monika

  • Not too shy to talk

  • Posts: 103

  • Since: 2008/12/19


Well I have just tested it on registration. Because my aim was to show members' birth day on their profile. But because of this bug, it only shows the default date whatever the new registred member has selected as a date.




8
zorro87
Re: Profile module date bug, request fix
  • 2009/3/26 11:16

  • zorro87

  • Just popping in

  • Posts: 92

  • Since: 2006/9/29


Hi!

This is a very interesting problem!

I confirm: You have to go back to the profile to change date and then, the date is saved correctly.

A clue?

Dates are saves as UNIX format
0=1970-01-01

When you first save a date, the date (field date in profile_profile) is saved as a 4 digit number corresponding to the year of the date you selected (ex.“1975” if you chose 1975-03-15 as date).

This date (1975-03-15) should be saved as: 164070000 (UNIX time)

The date was not translated as a UNIX date and
1975 is understood as 1970-01-01 and 1975 seconds (UNIX date)
It is the reason why the date appears as 1970-01-01

With this date format (0 = 1970-01-01) there is a problem:

You can't make a date as mandatory field because default date always exist!
(0 UNIX = 1970-01-01)

Can’t we have date field save in this format 1970-01-01?

It is just a suggestion…
What do you think about that?


@+
Z

9
trabis
Re: Profile module date bug, request fix
  • 2009/3/26 19:57

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Edit profile/register.php around line 101,

Replace the foreach loop with this:
foreach (array_keys($fields) as $field) {
        if (!isset(
$_POST[$field])) continue;
        
$value $fields[$field]->getValueForSave($_POST[$field]);
        if (
in_array($field$userfields)) {
            
$newuser->setVar($field$value);
        } else {
            
$profile->setVar($field$value);
        }
    }

10
zorro87
Re: Profile module date bug, request fix
  • 2009/3/27 9:03

  • zorro87

  • Just popping in

  • Posts: 92

  • Since: 2006/9/29


Hi Trabis!

Trabis, you are the best!

This bug is fixed!
Quote:

The problem is when someone wants to register, he choose his birthday DATE, but it is not saved during registration!!

He has to go back to his profile and edit the DATE again!! then it will be saved correctly.


Thank you Trabis!


@+
Z

Login

Who's Online

434 user(s) are online (304 user(s) are browsing Support Forums)


Members: 0


Guests: 434


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits