JomSocial 3.1 Common Upgrade Issues

Note: The explanations in this article only apply to sites that are being upgraded to JomSocial 3.1 from earlier versions.
If you are starting from a fresh sites, you'll most likely never experience issues explained here

Failed to parse time string

Timestring.png

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.

Warning: Before you proceed, please backup your entire site and whole database

First, navigate to your database. You will most likely use phpMyAdmin as a common software to manage your database

Note: The images shown bellow might differ in various versions of phpMyAdmin. If that is the case, please refer to the phpMyAdmin Manual

Once database have been selected, navigate to Search tab

Phpmyadminseach.png

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

Phpmyadminseach2.png

You should see similar result like on the picture bellow

Phpmyadminseach3.png

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

  1. field code for gender field is FIELD_GENDER
  2. Field code for birthdate field is FIELD_BIRTHDATE
Fieldnames.png

Memberlocation Map Shows Doubled values

Memberlocation.png

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

Warning: Fixing this issue is very simple, but before you proceed, backup your database

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