Profile Dates

OK, I've set my preferences in Admin\Settings\Advanced Settings to the following:

  • Short Date format: %m/%d/%Y
  • Long Date format: %m/%d/%Y %H:%i
  • PHP Date format: F j, Y

But in the profiles, when editing a profile you have to enter it as dd/mm/yyyy, shouldn't it be mm/dd/yyyy because of the preferences set in the advanced settings? Also, when viewing someone elses profile, the birth date shows up as yyyy-mm-dd. Does none of this use the preferences set in the Advanced Settings page? If not, where can I change it?

Keith

Quote · 13 Aug 2008

Admin > settings > Languages Settings > Search for strings > look for: day
and set the {0} January, {1} to which ever format you want for all 12 months  ..... 
.

Quote · 13 Aug 2008

Thanks RumpyBumpy. But I don't understand what "{0} July, {1}" means. What do the numbers do or is there someplace I can look up all the different values?

Keith

Quote · 13 Aug 2008

 

Admin > settings > Languages Settings > Search for strings > look for: day
and set the {0} January, {1} to which ever format you want for all 12 months  ..... 
.

 

I'm having issues as well.  Everything is set up so I can have to format in my profiles as mm/dd/yyyy.  In the Language Settings I did a search for 'days' and changed everything to January {0}, {1}....I have the format in my admin settings the same way...for some reason, ONLY in my profiles the birthdate is still YYYY/MM/DD, everywhere else it's the format that I preferred.

 

Anyone?

 

Quote · 13 Aug 2008

I'm starting to think we'll have to change something in the field builder. In there are the requirements for the field but how to change it I don't know, maybe someone can help out?

General Tab of Fields Builder for DateOfBirth

Advanced Tab of Fields Builder for DateOfBirth

Quote · 13 Aug 2008

how about a DOB to age mod to fix ....script needs rework for what u want....

I have video tutorials to help you mrpowless.com
Quote · 14 Aug 2008

Thanks RumpyBumpy. But I don't understand what "{0} July, {1}" means. What do the numbers do or is there someplace I can look up all the different values?

Keith

{0} January, {1}
01 Janurary, 2008

January {0}, {1}
January 01, 2008

{1}, Janurary {0}
2008, Janurary 01

etc, etc  .....

Quote · 14 Aug 2008

how about a DOB to age mod to fix ....script needs rework for what u want....

I hate to hear that, but I don't want to modify too much so when it comes time to upgrade it won't be too terribly difficult. But I suppose that may be a legitimate solution.

{0} January, {1} 01 Janurary, 2008 January {0}, {1} January 01, 2008 {1}, Janurary {0} 2008, Janurary 01 etc, etc .....

Thanks RumpyBumpy, that makes sense.

I'm starting to think we'll have to change something in the field builder.

Now I'm not so sure, because the field will accept mm/dd/yyyy, but when you go view the DateOfBirth in the profile it reads 00/00/0000. So, maybe it's something with the database design of that column? I'm no DB Developer or PHP Developer for that matter (but I do know enough to get around and figure it out). So I believe that MrPowless is correct that it'll take modification of the script to get this to display properly. Hopefully someone has fixed this on their site and will chime in.

Quote · 14 Aug 2008

Its heavily coded to go in and come out of the DB as is, rewrite needed.

the DOB to age is a simple 8 liner no biggie..fastest quickest solution

I have video tutorials to help you mrpowless.com
Quote · 15 Aug 2008

OK, I'm game. Where can I find it?

Keith

Quote · 15 Aug 2008

So... does anybody have a fix for this that actually works?

I'd like to set the birth date on both the signup page and the profile view to be mm/dd/yyyy instead of dd-mm-yyyy. None of the solutions posted here so far fix this.

Quote · 17 Aug 2008

Ok, found a simple way to format the dates on the profile view page...

In inc/classes/BxDolProfileFields.php, there's a function called getViewableDate that doesn't seem to do anything. It's called by the sub that formats the data to be displayed on the profile view page.

The original function:

function getViewableDate( $sDate ) {
return $sDate;
}

Here's a verson of the function that will format the dates using the Short Date defined in the admin control panel:

function getViewableDate( $sDate ) {
return (strftime(getParam('short_date_format'), strtotime($sDate)));
}

Or, if you'd prefer to use the PHP Date Format defined in the admin control panel:

function getViewableDate( $sDate ) {
return (date(getParam('php_date_format'), strtotime($sDate)));
}

This will format the Registration Date, Last Login Date, Last Profile Edit Date and Date of Birth fields.

Quote · 23 Aug 2008

Cool, I'll give that a try and report back. It'll probably be tomorrow before I can check it out.

Keith

Quote · 24 Aug 2008

@ mikelbeck

 

Your solution is working fine :-)

Thanks a lot :-)

Life is a fatal disease, sexually transmissible - Virginity is carcinogenic! Ask here for vaccine.
Quote · 24 Aug 2008

@ mikelbeck

Your solution is working fine :-)

Thanks a lot :-)

Good to hear... glad I could help.

Quote · 24 Aug 2008

Seems to work but I think the file you are referring to edit is:
inc/classes/BxDolProfileFields.php in dolphin 6.1.4 anyway

I see your post mentioned inc/classes/BxDolEvents.php maybe a type o.

gameutopia

DialMe.com - Your One and Only Source For Boonex Dolphin Tutorials and Resources
Quote · 25 Aug 2008

Seems to work but I think the file you are referring to edit is:
inc/classes/BxDolProfileFields.php in dolphin 6.1.4 anyway

I see your post mentioned inc/classes/BxDolEvents.php maybe a type o.

gameutopia

Yes, that's correct. I've fixed my post, thanks for pointing it out.

Quote · 26 Aug 2008

 

Its heavily coded to go in and come out of the DB as is, rewrite needed.

the DOB to age is a simple 8 liner no biggie..fastest quickest solution

 

I am interested in this.  Where can I find it?

Quote · 26 Aug 2008

Very odd thing about this, it worked yesterday when I tried it. But today when I signed in on profile page it told me my last login was 12-31-1969 or something like that. Dates did seem right in other locations.

I don't recall editing anything else during this time, but you never know. I do tend to change a lot of other things that could be messing with it too.

gameutopia

dialme.com

DialMe.com - Your One and Only Source For Boonex Dolphin Tutorials and Resources
Quote · 26 Aug 2008

inc/classes/BxDolProfileFields.php solution works, but it mess "last login" and "last edit" dates. So small correction can fix that too.

find:

function getViewableDate( $sDate ) {
return $sDate;
}

and replace it with:

function getViewableDate( $sDate ) {
return (strftime(getParam('short_date_format'), strtotime($sDate)));
}

function getViewableDate2( $sDate ) {
return $sDate;
}

Now we have two functions: one that we modified and will use for our date and original one getViewableDate2 which will use to avoid wrong "last" dates. Now we need to go and use that getViewableDate2 at "last" dates. Find this function getViewableValue( $aItem, $sValue ) and there is:

case 'DateLastEdit':
case 'DateLastLogin':
return $this -> getViewableDate( $sValue );

just replace getViewableDate with getViewableDate2 like:

case 'DateLastEdit':
case 'DateLastLogin':
return $this -> getViewableDate2( $sValue );

and done. Now you have correct dates for DOB and last login/edit.

Cheers,

George

Quote · 3 Sep 2008

@keithstric,

To allow users to enter dates in m/d/y format on the Profile Edit page, open up inc/classes/BxDolProfileFields.php and look for the following line:

list( $iDay, $iMonth, $iYear ) = explode( '/', $_POST[$sItemName][$iHuman] );

and change it to:

list( $iMonth, $iDay, $iYear ) = explode( '/', $_POST[$sItemName][$iHuman] );

I still need to figure out how to change how the dates are loaded into the Profile Edit form, and how the jQuery calendar's date format is set.

If anyone knows either of these, please don't hesitate to post

Best,

Mike E.

Quote · 11 Dec 2008

OK, to get the date to display properly in the form when it is first displayed, look for the following line in BxDolProfileFields.php:

$mValue = (int)$aDate[2] . '/' . (int)$aDate[1] . '/' . $aDate[0];  

Change it to:

$mValue = (int)$aDate[1] . '/' . (int)$aDate[2] . '/' . $aDate[0];

It still displays d/m/y when the form is redisplayed after the save.  Looking for that next.

Quote · 11 Dec 2008

To get the date to redisplay properly after the save, open pedit.php and look for the following lines:

elseif( $aItem['Name'] == 'Membership' )
    $aCol0['Value'] = getMemberMembershipInfo($this -> iProfileID);   

Insert the following lines right after them:

if( isset($_POST['do_submit']) ) {
    if( $aItem['Type'] == 'date' ) {
        $psDate = explode( '/', $aCol0['Value'] ); // DD/MM/YYYY
        $aCol0['Value'] = (int)$psDate[1] . '/' . (int)$psDate[0] . '/' . $psDate[2];  //MM-DD-YYYY
    }
}

I am certain there is a better way to do this, but I just cannot find it.

Mike E.

Quote · 11 Dec 2008

To change the datepicker, look in pedit.php for:

$sDatepickerInit = str_replace( '{dfl_days}', $iSelectedRel, $sDatepickerInit );

and replace it with:

$sDatepickerInit = str_replace( 'd/m/yy', 'm/d/yy', $sDatepickerInit );
Quote · 11 Dec 2008

Thanks for the hard work, meovino! Works great! I just have one thing to add...

It looks like you forgot the format of the date that is output by the date picker on the account signup (join) page. After your edits, it still spits out dates in the format d/m/yy. So, here is one last edit to fix that:

Find this in /join.php:

$sDatepickerInit = str_replace( '{dfl_days}', $iSelectedRel, $sDatepickerInit );

Add this code immediately after it:

$sDatepickerInit = str_replace( 'd/m/yy', 'm/d/yy', $sDatepickerInit );

Quote · 14 Feb 2009

When I apply the changes listed for the datepicker in both pedit.php and join.php the Date Picker no longer works, it doesn't display the popup calendar but rather just gives me a text edit field.

Quote · 25 Feb 2009

Okay, meovino's last post stated "and replace it with:" but rather than replacing his line of code you need to add it under the datepicker code.

Quote · 27 Feb 2009

To get the date to redisplay properly after the save, open pedit.php and look for the following lines:

elseif( $aItem['Name'] == 'Membership' )
    $aCol0['Value'] = getMemberMembershipInfo($this -> iProfileID);   

Insert the following lines right after them:

if( isset($_POST['do_submit']) ) {
    if( $aItem['Type'] == 'date' ) {
        $psDate = explode( '/', $aCol0['Value'] ); // DD/MM/YYYY
        $aCol0['Value'] = (int)$psDate[1] . '/' . (int)$psDate[0] . '/' . $psDate[2];  //MM-DD-YYYY
    }
}

I am certain there is a better way to do this, but I just cannot find it.

Mike E.

This doesn't seem to work, at least not for me.  When I go into edit profile it display the date the way I want (mm/dd/yy) but when I edit it and save it reverts it back to dd/mm/yy and saves it that way so everthing else is now off again and the date picker pulls up the month for the first 2 digits (if it's a valid month, otherwise it brings up today.

For example, I join and enter a date 01/02/65 and it saves fine.  I go in to edit and it still displays fine.  I click on the bdate field and the date picker calendar display, still with the correct date.  I rechose the date 01/02/65 and it still displays fine.  I save and now it show 02/01/65 and if I click on it the date picker calendar shows Feb 1965.

I go and check everywhere else and it now displays as 02/01/65.

If I had chosen 01/29/65 it saves as 29/01/65 and the date picker will bring up the current date since there isn't a month 29.

Quote · 28 Feb 2009

Okay, never mind.  My fault, I missed one of the edits in pedit.php.  Followed the directions listed to a T and now everything works fine.

Thanks and my aplogies if I caused any confusion.

Quote · 2 Mar 2009

Ok did all these suggestions, but datepicker does not show up in edit profile settings and still puts date of registeration as 1976.

Could there be anything with this line on BxDolProfileFields.php?

function getAge( $sBirthDate ) { // 28/10/1985
$bd = explode( '/', $sBirthDate );
foreach ($bd as $i => $v) $bd[$i] = (int)$v;

if ( date('n') > $bd[1] || ( date('n') == $bd[1] && date('j') >= $bd[0] ) )
$age = date('Y') - $bd[2];
else
$age = date('Y') - $bd[2] - 1;

return $age;
}

and

case 'date':
$aDate = explode( '-', $mValue ); //YYYY-MM-DD
$mValue = (int)$aDate[1] . '/' . (int)$aDate[2] . '/' . $aDate[0];
break;

Love here your thought

Quote · 16 Jun 2009
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.