[TH] Date Field for Custom Fields (Custom Field XML) [Deleted]

But the 'relative' dates (i.e., today, yesterday) are in use.
I post a message in a thread but its date is the 'relative' date - "A moment ago", then "1 minute ago". Also i create a thread, and for a while its date is "Today".
 
To my mind i didn't see exactly what this addon do. It doesn't fix all Xenforo dates, it uses only in Custom Fields by Waindigo. Or not?
 
To my mind i didn't see exactly what this addon do. It doesn't fix all Xenforo dates, it uses only in Custom Fields by Waindigo. Or not?
The features of this date field apply ONLY to fields created using Custom Fields by Waindigo. It doesn't affect anything else.
 
  • Like
Reactions: KiF
I get this error on this date-field. It happens in threwad-view as well as in forum-view but only after a date has been set.

An exception occurred: DateTime::setTimestamp() expects parameter 1 to be long, string given in /data/www/xen/library/XenForo/Locale.php on line 162
  1. XenForo_Application::handlePhpError()
  2. DateTime->setTimestamp() in XenForo/Locale.php at line 162
  3. XenForo_Locale::_getDateObject() in XenForo/Locale.php at line 307
  4. XenForo_Locale::date() in Waindigo/CustomDate/CustomField.php at line 55
  5. Waindigo_CustomDate_CustomField::valueDisplay()
  6. call_user_func_array() in Waindigo/CustomFields/ViewPublic/Helper/Thread.php at line 65
  7. Waindigo_CustomFields_ViewPublic_Helper_Thread::getThreadFieldValueHtml() in Waindigo/CustomFields/ViewPublic/Helper/Thread.php at line 103
  8. Waindigo_CustomFields_ViewPublic_Helper_Thread::addThreadFieldsValueHtml() in Waindigo/CustomFields/Extend/XenForo/ViewPublic/Thread/View.php at line 21
  9. Waindigo_CustomFields_Extend_XenForo_ViewPublic_Thread_View->renderHtml() in XenForo/ViewRenderer/Abstract.php at line 227
  10. XenForo_ViewRenderer_Abstract->renderViewObject() in XenForo/ViewRenderer/HtmlPublic.php at line 67
  11. XenForo_ViewRenderer_HtmlPublic->renderView() in XenForo/FrontController.php at line 572
  12. XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
  13. XenForo_FrontController->run() in /data/www/xen/index.php at line 13
 
|This is really I bug I tyhink. the value-variable is empty when it reaches the valuedisplay-function. Hope (think) this might be easy to fix..
 
Can you check that you are still using the verifyDate method to verify the date? From the error it looks like the data is not being stored properly, hence it is causing an error.
 
XF 1.2.3 / XFRM 1.1.
I have several Field Groups in ACP Custom Resource Fields. After deleting Date Field all Titles of Field Groups are disappeared after follow the link Resource Fields (/admin.php?resource-fields/) in the sidebar (but not the refreshing page). Resource fields are rearranged too as they were in order by field groups base. Import Field back and groups titles become visible and categories order is back.
 
XF 1.2.3 / XFRM 1.1.
I have several Field Groups in ACP Custom Resource Fields. After deleting Date Field all Titles of Field Groups are disappeared after follow the link Resource Fields (/admin.php?resource-fields/) in the sidebar (but not the refreshing page). Resource fields are rearranged too as they were in order by field groups base. Import Field back and groups titles become visible and categories order is back.
Sounds like it is redirecting to the wrong place after deleting. I will look into it.
 
I get this error when i create a thread with date field. Without date field no error.

Code:
ErrorException: unserialize(): Error at offset 0 of 10 bytes - library/Waindigo/CustomDate/CustomField.php:23
Généré par: Garfieldisback, Il y a un instant
Trace de la pile
#0 [internal function]: XenForo_Application::handlePhpError(8, 'unserialize(): ...', '/home/mywebsite/p...', 23, Array)
#1 /home/mywebsite/prod/library/Waindigo/CustomDate/CustomField.php(23): unserialize('2014-01-01')
#2 [internal function]: Waindigo_CustomDate_CustomField::verifyDate(Array, '2014-01-01', false)
#3 /home/mywebsite/prod/library/Waindigo/CustomFields/Model/ThreadField.php(574): call_user_func_array(Array, Array)
#4 /home/mywebsite/prod/library/Waindigo/CustomFields/Extend/XenForo/DataWriter/Discussion/Thread.php(160): Waindigo_CustomFields_Model_ThreadField->verifyThreadFieldValue(Array, '2014-01-01', false)
#5 /home/mywebsite/prod/library/Waindigo/CustomFields/Extend/XenForo/DataWriter/Discussion/Thread.php(80): Waindigo_CustomFields_Extend_XenForo_DataWriter_Discussion_Thread_Base->setCustomFields(Array, Array)
#6 /home/mywebsite/prod/library/Waindigo/ThreadThumbnails/Extend/XenForo/DataWriter/Discussion/Thread.php(31): Waindigo_CustomFields_Extend_XenForo_DataWriter_Discussion_Thread_Base->_discussionPreSave()
#7 /home/mywebsite/prod/library/SimplePortal/Extend/DataWriter/Discussion/Thread.php(35): Waindigo_ThreadThumbnails_Extend_XenForo_DataWriter_Discussion_Thread->_discussionPreSave()
#8 /home/mywebsite/prod/library/XenForo/DataWriter/Discussion.php(308): SimplePortal_Extend_DataWriter_Discussion_Thread->_discussionPreSave()
#9 /home/mywebsite/prod/library/XenForo/DataWriter.php(1434): XenForo_DataWriter_Discussion->_preSave()
#10 /home/mywebsite/prod/library/XenForo/DataWriter.php(1373): XenForo_DataWriter->preSave()
#11 /home/mywebsite/prod/library/*******/MetadataEssential/DataWriter/Discussion/Thread.php(11): XenForo_DataWriter->save()
#12 /home/mywebsite/prod/library/XenForo/ControllerPublic/Thread.php(945): *******_MetadataEssential_DataWriter_Discussion_Thread->save()
#13 /home/mywebsite/prod/library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Thread.php(234): XenForo_ControllerPublic_Thread->actionSave()
#14 /home/mywebsite/prod/library/Waindigo/ThreadThumbnails/Extend/XenForo/ControllerPublic/Thread.php(40): Waindigo_CustomFields_Extend_XenForo_ControllerPublic_Thread->actionSave()
#15 /home/mywebsite/prod/library/*******/MetadataEssential/ControllerPublic/Thread.php(31): Waindigo_ThreadThumbnails_Extend_XenForo_ControllerPublic_Thread->actionSave()
#16 /home/mywebsite/prod/library/XenForo/FrontController.php(347): *******_MetadataEssential_ControllerPublic_Thread->actionSave()
#17 /home/mywebsite/prod/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#18 /home/mywebsite/prod/index.php(13): XenForo_FrontController->run()
#19 {main}
Etat de la requête
array(3) {
["url"] => string(83) "http://mywebsite.net/topic/perdu.186/save"
["_GET"] => array(0) {
}
["_POST"] => array(9) {
["prefix_id"] => string(2) "85"
["title"] => string(52) "PERDU"
["discussion_open"] => string(1) "1"
["_set"] => array(2) {
["discussion_open"] => string(1) "1"
["sticky"] => string(1) "1"
}
["BRME_meta_title"] => string(0) ""
["BRME_meta_description"] => string(0) ""
["custom_fields"] => array(9) {
["date_perte"] => string(10) "2014-01-01"
["sexe"] => string(4) "male"
["race"] => string(17) "Berger Australien"
["couleur"] => string(15) "noir blanc roux"
["tatouage"] => string(3) "non"
["puce"] => string(3) "oui"
["code_postal"] => string(5) "82200"
["ville"] => string(6) "Cayrac"
["telephone"] => string(0) ""
}
["custom_fields_shown"] => array(9) {
[0] => string(10) "date_perte"
[1] => string(4) "sexe"
[2] => string(4) "race"
[3] => string(7) "couleur"
[4] => string(8) "tatouage"
[5] => string(4) "puce"
[6] => string(11) "code_postal"
[7] => string(5) "ville"
[8] => string(9) "telephone"
}
["_xfToken"] => string(8) "********"
}
}
Supprimer... Fermer
 
I'm getting this error:


ErrorException: unserialize(): Error at offset 0 of 10 bytes - library/Waindigo/CustomDate/CustomField.php:23

#0 [internal function]: XenForo_Application::handlePhpError('2014-06-11')
#1 /home/thebaby/public_html/forum/library/Waindigo/CustomDate/CustomField.php(23): unserialize(Array, '2014-06-11', false)
#2 [internal function]: Waindigo_CustomDate_CustomField::verifyDate(Array, Array)
#3 /home/thebaby/public_html/forum/library/Waindigo/CustomPostFields/Model/PostField.php(616): call_user_func_array(Array, '2014-06-11', false)
#4 /home/thebaby/public_html/forum/library/Waindigo/CustomPostFields/Extend/XenForo/DataWriter/DiscussionMessage/Post.php(173): Waindigo_CustomPostFields_Model_PostField->verifyPostFieldValue(Array, Array)
#5 /home/thebaby/public_html/forum/library/Waindigo/CustomPostFields/Extend/XenForo/DataWriter/DiscussionMessage/Post.php(77): Waindigo_CustomPostFields_Extend_XenForo_DataWriter_DiscussionMessage_Post->setCustomPostFields()
#6 /home/thebaby/public_html/forum/library/Waindigo/Thumbnails/Extend/XenForo/DataWriter/DiscussionMessage/Post.php(12): Waindigo_CustomPostFields_Extend_XenForo_DataWriter_DiscussionMessage_Post->_messagePreSave()
#7 /home/thebaby/public_html/forum/library/Nobita/ScheduledPost/XenForo/DataWriter/DiscussionMessage/Post.php(20): Waindigo_Thumbnails_Extend_XenForo_DataWriter_DiscussionMessage_Post->_messagePreSave()
#8 /home/thebaby/public_html/forum/library/XenForo/DataWriter/DiscussionMessage.php(392): Nobita_ScheduledPost_XenForo_DataWriter_DiscussionMessage_Post->_messagePreSave()
#9 /home/thebaby/public_html/forum/library/XenForo/DataWriter.php(1446): XenForo_DataWriter_DiscussionMessage->_preSave()
#10 /home/thebaby/public_html/forum/library/XenForo/ControllerPublic/Thread.php(542): XenForo_DataWriter->preSave()
#11 /home/thebaby/public_html/forum/library/Waindigo/Trophies/Extend/XenForo/ControllerPublic/Thread.php(34): XenForo_ControllerPublic_Thread->actionAddReply()
#12 /home/thebaby/public_html/forum/library/Waindigo/CustomPostFields/Extend/XenForo/ControllerPublic/Thread.php(105): Waindigo_Trophies_Extend_XenForo_ControllerPublic_Thread->actionAddReply()
#13 /home/thebaby/public_html/forum/library/Nobita/ScheduledPost/XenForo/ControllerPublic/Thread.php(290): Waindigo_CustomPostFields_Extend_XenForo_ControllerPublic_Thread->actionAddReply()
#14 /home/thebaby/public_html/forum/library/XenForo/FrontController.php(347): Nobita_ScheduledPost_XenForo_ControllerPublic_Thread->actionAddReply(Object(XenForo_RouteMatch))
#15 /home/thebaby/public_html/forum/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch()
#16 /home/thebaby/public_html/forum/index.php(13): XenForo_FrontController->run()
#17 {main}

Any ideas?
 
I'm getting an error when this is enabled:

Server Error Log
Error Info
ErrorException: Undefined index: threads - library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Forum.php:60
Generated By: Testing, A moment ago
Stack Trace
#0 /home/site/site.com/library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Forum.php(60): XenForo_Application::handlePhpError(8, 'Undefined index...', '/home/site/...', 60, Array)
#1 /home/site/site.com/library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Forum.php(31): Waindigo_CustomFields_Extend_XenForo_ControllerPublic_Forum->_addCustomThreadFields(Object(XenForo_ControllerResponse_View))
#2 /home/site/site.com/library/EWRporta/ControllerPublic/Forum.php(23): Waindigo_CustomFields_Extend_XenForo_ControllerPublic_Forum->actionForum()
#3 /home/site/site.com/library/XenForo/FrontController.php(347): EWRporta_ControllerPublic_Forum->actionForum()
#4 /home/site/site.com/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#5 /home/site/site.com/index.php(13): XenForo_FrontController->run()
#6 {main}
Request State
array(3) {
["url"] => string(52) "http://site.com/forums/rants-and-raves.22/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}


Server Error Log
Error Info
ErrorException: Invalid argument supplied for foreach() - library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Forum.php:60
Generated By: Testing, 3 minutes ago
Stack Trace
#0 /home/site/site.com/library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Forum.php(60): XenForo_Application::handlePhpError(2, 'Invalid argumen...', '/home/site/...', 60, Array)
#1 /home/site/site.com/library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Forum.php(31): Waindigo_CustomFields_Extend_XenForo_ControllerPublic_Forum->_addCustomThreadFields(Object(XenForo_ControllerResponse_View))
#2 /home/site/site.com/library/EWRporta/ControllerPublic/Forum.php(23): Waindigo_CustomFields_Extend_XenForo_ControllerPublic_Forum->actionForum()
#3 /home/site/site.com/library/XenForo/FrontController.php(347): EWRporta_ControllerPublic_Forum->actionForum()
#4 /home/site/site.com/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#5 /home/site/site.com/index.php(13): XenForo_FrontController->run()
#6 {main}
Request State
array(3) {
["url"] => string(52) "http://site.com/forums/rants-and-raves.22/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}


--------------
--------------
Strange errors that I see in the error log. And it only happens in one forum apparently. When I try browsing the particular forum - I see the error message:

Sitename - Error
A server error occurred. Please try again later.

I'd love to call this issue FIXED!
Any help will be appreciated.

Thanks!

J.
 
Last edited:
...
tumbleweedt.gif
...
Okay. Uninstalled. But thanks for the share just the same.

J.
 
The bug is in the verifyDate function. @Waindigo tries to catch a warning with a try/catch function which only catches exceptions.

Maybe something like this could fix this:

PHP:
   public static function verifyDate(array $field, &$value, &$error)
    {
        try {
            if (is_array($value))
            {
                $value = unserialize($value);
            }
 
The bug is in the verifyDate function. @Waindigo tries to catch a warning with a try/catch function which only catches exceptions.

Maybe something like this could fix this:

PHP:
   public static function verifyDate(array $field, &$value, &$error)
    {
        try {
            if (is_array($value))
            {
                $value = unserialize($value);
            }

Thanks for posting @JulianD! But that's way over my head and a wee bit out of my realm of expertise.
I would ask you to translate. I'm afraid even then -- as someone not at all familiar with php code -- it would be over my head.
Are you suggesting a copy/paste replace of code? If yes - which file please. I'd like to test the code you've posted to see if it will sort the issue I was having.
Thanks again ;)

J.
 
Thanks for posting @JulianD! But that's way over my head and a wee bit out of my realm of expertise.
I would ask you to translate. I'm afraid even then -- as someone not at all familiar with php code -- it would be over my head.
Are you suggesting a copy/paste replace of code? If yes - which file please. I'd like to test the code you've posted to see if it will sort the issue I was having.
Thanks again ;)

J.
Oh, I'm sorry. I was talking about this error:

I get this error when i create a thread with date field. Without date field no error.

Code:
ErrorException: unserialize(): Error at offset 0 of 10 bytes - library/Waindigo/CustomDate/CustomField.php:23
Généré par: Garfieldisback, Il y a un instant
Trace de la pile
#0 [internal function]: XenForo_Application::handlePhpError(8, 'unserialize(): ...', '/home/mywebsite/p...', 23, Array)
#1 /home/mywebsite/prod/library/Waindigo/CustomDate/CustomField.php(23): unserialize('2014-01-01')
#2 [internal function]: Waindigo_CustomDate_CustomField::verifyDate(Array, '2014-01-01', false)
#3 /home/mywebsite/prod/library/Waindigo/CustomFields/Model/ThreadField.php(574): call_user_func_array(Array, Array)
#4 /home/mywebsite/prod/library/Waindigo/CustomFields/Extend/XenForo/DataWriter/Discussion/Thread.php(160): Waindigo_CustomFields_Model_ThreadField->verifyThreadFieldValue(Array, '2014-01-01', false)
#5 /home/mywebsite/prod/library/Waindigo/CustomFields/Extend/XenForo/DataWriter/Discussion/Thread.php(80): Waindigo_CustomFields_Extend_XenForo_DataWriter_Discussion_Thread_Base->setCustomFields(Array, Array)
#6 /home/mywebsite/prod/library/Waindigo/ThreadThumbnails/Extend/XenForo/DataWriter/Discussion/Thread.php(31): Waindigo_CustomFields_Extend_XenForo_DataWriter_Discussion_Thread_Base->_discussionPreSave()
#7 /home/mywebsite/prod/library/SimplePortal/Extend/DataWriter/Discussion/Thread.php(35): Waindigo_ThreadThumbnails_Extend_XenForo_DataWriter_Discussion_Thread->_discussionPreSave()
#8 /home/mywebsite/prod/library/XenForo/DataWriter/Discussion.php(308): SimplePortal_Extend_DataWriter_Discussion_Thread->_discussionPreSave()
#9 /home/mywebsite/prod/library/XenForo/DataWriter.php(1434): XenForo_DataWriter_Discussion->_preSave()
#10 /home/mywebsite/prod/library/XenForo/DataWriter.php(1373): XenForo_DataWriter->preSave()
#11 /home/mywebsite/prod/library/*******/MetadataEssential/DataWriter/Discussion/Thread.php(11): XenForo_DataWriter->save()
#12 /home/mywebsite/prod/library/XenForo/ControllerPublic/Thread.php(945): *******_MetadataEssential_DataWriter_Discussion_Thread->save()
#13 /home/mywebsite/prod/library/Waindigo/CustomFields/Extend/XenForo/ControllerPublic/Thread.php(234): XenForo_ControllerPublic_Thread->actionSave()
#14 /home/mywebsite/prod/library/Waindigo/ThreadThumbnails/Extend/XenForo/ControllerPublic/Thread.php(40): Waindigo_CustomFields_Extend_XenForo_ControllerPublic_Thread->actionSave()
#15 /home/mywebsite/prod/library/*******/MetadataEssential/ControllerPublic/Thread.php(31): Waindigo_ThreadThumbnails_Extend_XenForo_ControllerPublic_Thread->actionSave()
#16 /home/mywebsite/prod/library/XenForo/FrontController.php(347): *******_MetadataEssential_ControllerPublic_Thread->actionSave()
#17 /home/mywebsite/prod/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#18 /home/mywebsite/prod/index.php(13): XenForo_FrontController->run()
#19 {main}
Etat de la requête
array(3) {
["url"] => string(83) "http://mywebsite.net/topic/perdu.186/save"
["_GET"] => array(0) {
}
["_POST"] => array(9) {
["prefix_id"] => string(2) "85"
["title"] => string(52) "PERDU"
["discussion_open"] => string(1) "1"
["_set"] => array(2) {
["discussion_open"] => string(1) "1"
["sticky"] => string(1) "1"
}
["BRME_meta_title"] => string(0) ""
["BRME_meta_description"] => string(0) ""
["custom_fields"] => array(9) {
["date_perte"] => string(10) "2014-01-01"
["sexe"] => string(4) "male"
["race"] => string(17) "Berger Australien"
["couleur"] => string(15) "noir blanc roux"
["tatouage"] => string(3) "non"
["puce"] => string(3) "oui"
["code_postal"] => string(5) "82200"
["ville"] => string(6) "Cayrac"
["telephone"] => string(0) ""
}
["custom_fields_shown"] => array(9) {
[0] => string(10) "date_perte"
[1] => string(4) "sexe"
[2] => string(4) "race"
[3] => string(7) "couleur"
[4] => string(8) "tatouage"
[5] => string(4) "puce"
[6] => string(11) "code_postal"
[7] => string(5) "ville"
[8] => string(9) "telephone"
}
["_xfToken"] => string(8) "********"
}
}
Supprimer... Fermer

I haven't been able to reproduce your error so I don't have a fix available right now.
 
Top Bottom