Warning: unserialize(): Error at offset 16300 of 16351 bytes in /home/sgxducmc/demo.joomdle.com/libraries/src/Cache/Controller/OutputController.php on line 71
Joomdle - Cannot change date value - Joomdle
How To / General

Cannot change date value

  • noiseasy
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago - 8 years 11 months ago #1 by noiseasy
Cannot change date value was created by noiseasy
Hi to all, I have an issue with a date field. I have mapped the dob userprifile field in Joomla to a custom filed "date if birth" in Moodle type date.
When a user register in Joomla the date of birth in Moodle is 01-01-1970. If I change the value in Joomla nothing appened, but if I change that value in Moodle also changes in Joomla properly.
If I try to update profiles of Moodle from Joomdle, I get this warning:

Notice: Undefined index: in /home/format/public_html/administrator/components/com_joomdle/helpers/content.php on line 571
Notice: Undefined index: in /home/format/public_html/administrator/components/com_joomdle/helpers/content.php on line 580

And the date not change.
I also tried to map dob field to a text custom field in Moodle and the value passed to Moodle it's the correct timestamp
I have updated all to the latest version: Joomla 3.7, Moodle 3.2.3+, Joomdle 1.1.2
Last edit: 8 years 11 months ago by noiseasy.

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #2 by Antonio Durán
Replied by Antonio Durán on topic Cannot change date value
Hi. Thanks for the info.

I checked and it seems Joomla changed the database format for this field recently. I have done a change that seems to fix joomla to moodle sync. It will be included in nex release.
If you want to do it yourself now, here are instructions:
File: administrator/components/com_joomdle/helpers/mappings.php
Function: get_field_value_joomla16
Before the last line with the return statment, add:
Code:
if ($field == 'profile.dob') $field_obj->profile_value = strtotime(json_decode ($field_obj->profile_value));

Please Log in or Create an account to join the conversation.

  • noiseasy
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago #3 by noiseasy
Replied by noiseasy on topic Cannot change date value
YES It works. Thank you very much!!!

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #4 by Antonio Durán
Replied by Antonio Durán on topic Cannot change date value
Great, thanks for the feedback.

Please Log in or Create an account to join the conversation.