Sinisakrisan (Talk | contribs) (→Failed to parse time string) |
Sinisakrisan (Talk | contribs) (→Same Error Having a Gender Value) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 23: | Line 23: | ||
Now refresh your JomSocial dashboard. If error is gone, good, if other error is thrown (most likely on a large and dirty databases) just repeat the same process. | Now refresh your JomSocial dashboard. If error is gone, good, if other error is thrown (most likely on a large and dirty databases) just repeat the same process. | ||
− | == | + | ===Same Error Having a Gender Value=== |
+ | At times, you might experience the same error being unable to parse Gender value | ||
+ | <syntaxhighlight lang="php"> | ||
+ | DateTime::__construct() [datetime.--construct]: Failed to parse time string (Male) at position 0 (M) | ||
+ | </syntaxhighlight> | ||
+ | <br/> | ||
+ | This simply implies that scrip fetched gender value instead Birthdate field value<br /> | ||
+ | To correct it, ensure that | ||
+ | #field code for gender field is '''FIELD_GENDER''' | ||
+ | #Field code for birthdate field is '''FIELD_BIRTHDATE''' | ||
+ | :::[[File:Fieldnames.png]] | ||
− | == | + | ==Memberlocation Map Shows Doubled values== |
− | + | :::[[File:Memberlocation.png]] | |
− | == | + | As you can see there are '''doubled''' records for India and United States<br /> |
+ | Before we deal with it, lets first explain the reason that stands behind this issue.<br /> | ||
+ | The country field prior to JomSocial 3.0.4 was storing the record in a database as a plain value. In other words, when user selects his country to be '''India''' that exact value will be stored in the database.<br /> | ||
+ | JomSocial 3.0.4 onwards however, supports the country names translation and once user set its country to be India, this value is not stored in the database anymore. Instead, the '''COM_COMMUNITY_LANG_NAME_INDIA''' is stored, hence it is treated as a '''doubled''' record.<br /> | ||
+ | Basically your pre-3.0.4 users will have old value type and newer users will have new value type<br /> | ||
+ | <center>{{alert|'''Warning:''' Fixing this issue is very simple, but before you proceed, backup your database|alert-error}}</center> | ||
+ | Run this query in your database | ||
+ | <syntaxhighlight lang="sql"> | ||
+ | UPDATE prefix_community_fields_values SET value = REPLACE(value,"India","COM_COMMUNITY_LANG_NAME_INDIA"); | ||
+ | </syntaxhighlight> | ||
+ | <br/> | ||
+ | This query will replace all values stored as '''India''' into proper, translatable value and you will get rid of the doubled entries for specific country<br /> | ||
+ | You can see the language strings for all countries in ROOT/langauges/en-GB/en-GB.com_community_country.ini file |
Latest revision as of 07:58, 5 December 2013
If you are starting from a fresh sites, you'll most likely never experience issues explained here
Failed to parse time string
This is a very common error, specially for the sites which have old database (several years old sites) or those with a lot of dirty data
It looks like the error does not tell us anything special, but if you take a closer look, the error actually said that is failing to parse date string 1987-34-58 23:59:59 which is true, because 1987-34-58 23:59:59 can never be an actual date
In this case, 1987 is the year, 34 is the month and 54 is the day. Obviously, the date here is wrong.
It can also happen that you have completely date unrelated value like random string of characters, solution will however, be the same.
First, navigate to your database. You will most likely use phpMyAdmin as a common software to manage your database
Once database have been selected, navigate to Search tab
Insert the word you want to search for. In our case, it would be 1987-34-58 23:59:59'
Select to find exact phrase - This is particularly important as 1987 is a valid year and it could find more records if we don't set this option
Select All tables to be searched and click on Go button
You should see similar result like on the picture bellow
You can now either delete the record, or browse it further. Lets just click on Delete. We will leave up to you if you want to browse it further.
Now refresh your JomSocial dashboard. If error is gone, good, if other error is thrown (most likely on a large and dirty databases) just repeat the same process.
Same Error Having a Gender Value
At times, you might experience the same error being unable to parse Gender value
DateTime::__construct() [datetime.--construct]: Failed to parse time string (Male) at position 0 (M)
This simply implies that scrip fetched gender value instead Birthdate field value
To correct it, ensure that
- field code for gender field is FIELD_GENDER
- Field code for birthdate field is FIELD_BIRTHDATE
Memberlocation Map Shows Doubled values
As you can see there are doubled records for India and United States
Before we deal with it, lets first explain the reason that stands behind this issue.
The country field prior to JomSocial 3.0.4 was storing the record in a database as a plain value. In other words, when user selects his country to be India that exact value will be stored in the database.
JomSocial 3.0.4 onwards however, supports the country names translation and once user set its country to be India, this value is not stored in the database anymore. Instead, the COM_COMMUNITY_LANG_NAME_INDIA is stored, hence it is treated as a doubled record.
Basically your pre-3.0.4 users will have old value type and newer users will have new value type
Run this query in your database
UPDATE prefix_community_fields_values SET VALUE = REPLACE(VALUE,"India","COM_COMMUNITY_LANG_NAME_INDIA");
This query will replace all values stored as India into proper, translatable value and you will get rid of the doubled entries for specific country
You can see the language strings for all countries in ROOT/langauges/en-GB/en-GB.com_community_country.ini file