I just upgraded to Drupal 5.2 and did a fresh install of the latest UIEForum dev version.

When I create a thread, the "Last Post" date and time ALWAYS shows the text below -- do you know why, or how to fix this?

31 Dec 1969 - 18:00

I have the following modules installed:

CCK (Date, Fieldgroup, Node Reference, Number, Option Widgets, Text, User Reference)
Book
Color
Contact
Help
Menu
Poll
Profile
Search
Statistics
Taxonomy
Tracker
Event (Basic Event, Event Views, Event Repeat)
FCKeditor
UIE Forum
External Links
Views (Calendar, Views UI, Theme Wizard)

Out of curiosity, I disabled FCKEditor in case it was interfering, and still had the same problem. I haven't gone through disabling the other modules, but I don't see why they would interfere with UIEForum.

Comments

jmmec’s picture

Wanted to also note that the problem shows up regardless of who creates the post - i.e. admin (uid 1) or some other user (uid 2, etc...). The date is always "31 Dec 1969 - 18:00".

G Gavitt’s picture

I just installed the uieforum a few days ago and I had almost the same problem. (I think my date was fixed on 01/01/70) From what I can remember...(been a rough few days:]) I had to use the update script on the uieforum module (yoursite/update.php?op=selection) to fix it. I got a few sql errors on updating but my uieforum version was from a few days ago..there was also a patch that fixed it ( http://drupal.org/node/162274 ) but I am assuming its already rolled into the latest version.

daniel.hunt’s picture

I was worried that this would happen, but in all of my tests the dates appeared perfectly! :/

I've had a look at the install file, and I'm not convinced by the "DROP INDEX IF EXISTS" (it didn't work for me just there on a local test - something about my mysql version) so I suggest that you restore your backup from before the latest version (you [i]do[/i] have a backup - right?) and re-run the updates for uieforum. I've changed update 1 to add the index, and update 2 will then remove it.

If your forum is working fine as it is, just do:
UPDATE system SET schema_version=2 WHERE name LIKE '%uieforum%';

I'm not sure why the system is causing the dates to be wrong though.

G Gavitt’s picture

The forum post time stamps on my installation are working but with one problem. When I use the search form on my forums the search results have no time stamp. I get every thing else thread title, poster etc. but no time stamp. I did a chron run just for good measure and still no stamps. Tried posting a few new threads and posts ..still no stamps in the search listings... Related? I'll probobly just restore my backup and do a reinstall of the latest version..figured I mention it just in case its related.

modctek’s picture

I am getting this error on a brand new installation of UIE Forums with Drupal 5.1.

daniel.hunt’s picture

Assigned: Unassigned » daniel.hunt
Status: Active » Fixed

Hmm. I've just commited a change to the 2 files:
Functions.inc.php - line 1297 is now:
$ender = $time - $userslastpost;

UIEForum.modele - line 2198 is now:
'date' => strtotime($row->Posted),
Line 2220 is now:
$lastything = uieforum_parse_date($Thread->LastPost);

The next tar-run should sort out the problem. I think that your problem isn't actually with the creation of a post or thread, rather, with the display of the thread listings.
I've fixed the code that does this, so it should be ok now!

Thanks,
Daniel

daniel.hunt’s picture

Thanks Modctek - it should be fixed now (but the downloadable link won't give you the updated code until some time tomorrow morning I'm afraid.

modctek’s picture

I grabbed the DEV version available now (I saw your comment about the latest changes not being committed yet), and manually patched the indicated files. I now get:

PHP Parse error: syntax error, unexpected '(', expecting ')' in /srv/www/htdocs/dom/modules/uieforum/functions.inc.php on line 822

I noticed on a previous version of the DEV code that 822 looked like:

function uieforum_add_post($ThreadID, $Title, $Text)

Though its probably not syntax correct, I changed line 822 in the current build to:

function uieforum_add_post($ThreadID, $Title, $Text, $now = uieforum_get_now) <--removed the "()" from "uieforum_get_now()"

And my website will load now.

But, the date issue is still not corrected on my install. Perhaps I patched incorrectly?

daniel.hunt’s picture

Ah - apologies for that:

function uieforum_add_post($ThreadID, $Title, $Text, $now = null)
{
  Global $user;
  $Thread = get_thread($ThreadID);
  if(!$now)
  {
    $now = uieforum_get_now();
  }
modctek’s picture

That did it. Date problem fixed as well!

daniel.hunt’s picture

Excellent :)

Svpernova09’s picture

I'm still getting this problem as well. I've followed everything listed so far but the date problem remains.

Enabled Modules:
Fivestar
Voting API
UIEForum
Privatemsg
Image Gallery
Image Attach
Image
Upload
Tracker
Statistics
Search
Profile
Poll
Path
Menu
help
Contact
Comment
Book
Blog

daniel.hunt’s picture

Can you link me to the site in question, if it's public?

zolaster’s picture

Okay, brand new install of uieforum...I'm very concerned about the time/dates, as they're absolutely not working. Looking at the code, here is the problem. You are using unix timestamps. While this is all well and good, mysql does not use them. If you want to use DATE, DATETIME or TIMESTAMP as a type in mysql, and want to use unix timestamps, you must use the FROM_UNIXTIME() mysql function to convert from unix times to YYYYMMDDHHSS formats (which is what mysql uses). Its possible that mysql 5 has a default conversion for this, but 4.1 (which many many many people still use) does not.

I'm going through and modifying my local uie forum install, but I'd suggest you go through and fix this in your dev version.

daniel.hunt’s picture

Status: Fixed » Active

I'm not sure I understand what you're saying - what exactly are you changing in the code for this to work on your site?

maxrisc’s picture

I just grabbed the latest snapshot and installed it on my testing site. The date problem is not corrected. Using Mysql 4x.

I would help debug but I am way behind on another project. I will look in another couple of days when I get some time if it is still a problem.

daniel.hunt’s picture

Can you try something for me please? Can you copy/paste the current schema for your {F_Threads} table?

modctek’s picture

I can confirm the date problem is not fixed on the latest snapshot. I'll go through and see if reapplying the changes outlined in my previous posts works to resolve the issue.

This may be related to having an older UIE version installed, and then removed from the website without cleaning the related tables from the Drupal database. I noticed that the taxonomy tags for the forums were from my previous installation, and did not get updated/modified with my new fora structure. Is there a way to force a refresh there, or do I have to manually create the tags? Should I wipe everything and start from scratch. (Not so hard as the current implementation is on the "live" server but is very simple at the moment and not yet visible to anyone.)

daniel.hunt’s picture

Can you paste the schema for your current F_Threads table please? It may shed some light on this.
Also, try:
select schema_version from system where name='uieforum'

Techinica’s picture

Field Type Collation Attributes Null Default Extra

ThreadID int(8) No auto_increment
ThreadTitle varchar(255) utf8_general_ci No
Creator int(8) No 0
Created datetime No 0000-00-00 00:00:00
LastPoster int(8) Yes NULL
LastPost datetime No 0000-00-00 00:00:00
Locked enum('0', '1') utf8_general_ci No 0
Sticky enum('0', '1') utf8_general_ci No 0
ForumID int(12) Yes 2

I'm having the same issue, with the latest snapshot, on a clean install. Excepting my date states '01 Jan 1970 - 10:00'
ViewCount int(12) No 0
PostCount int(12) Yes 0

daniel.hunt’s picture

Yup - that's exactly the problem I thought it was.

You need to run www.mysite.com/update.php to upgrade the uieforum database schema :)

Techinica’s picture

Yep, that worked.

daniel.hunt’s picture

Status: Active » Fixed
vikingew’s picture

Status: Fixed » Active

Unfortunately I don't think this is fixed after all. I have the same problem, however my date is 01 Jan 1970 - 01:00, where the difference probably have to do with a timezone differ. May I dare to guess the original reporter is located somewhere on the US east coast? :-)

I have the latest dev aug 9, schema version 2 and I always run update.php and the db values inserted for "Created" and "LastPost" in F_Threads are 0000-00-00 00:00:00

I use Gentoo Linux, apache 2.2.4, mysql 5.0.44 and php 5.2.3

daniel.hunt’s picture

Status: Active » Fixed

I have the latest dev aug 9, schema version 2 and I always run update.php and the db values inserted for "Created" and "LastPost" in F_Threads are 0000-00-00 00:00:00

The fact that your columns are storing MySQL DateTimes points to the fact that you are not actually running schema version 2. They should now be of type int

Try this directly into your sql server:
UPDATE system SET schema_version=0 WHERE name='uieforum';

And then try re-running your update.php file. Also, make sure you make a backup of the database first, just incase.

I've marked the status back to fixed, as this is a schema-version problem :)

vikingew’s picture

yes that fixed it, thanks. I am sure though the system table said sheama 2 before as I checked it, so something must have gone wrong with update.php before. Nevermind, now it works and that's great!

webdrips’s picture

Status: Fixed » Active

I just grabbed the Aug 9 version and received the date problem I believe being discussed...(this is a fresh install, so I did not run update.php)

user warning: Incorrect datetime value: '1186791378' for column 'Created' at row 1 query: INSERT INTO F_Threads (ThreadID, ThreadTitle, Creator, Created, LastPoster, LastPost, Locked, Sticky, ForumID) VALUES (NULL,'Welcome to bla','1','1186791378','1','1186791378', '0', '0', 4) in C:\Mypath\database.mysqli.inc on line 151. 
user warning: Incorrect datetime value: '1186791378' for column 'Posted' at row 1 query: INSERT INTO F_Posts (PostID, PostTitle, ThreadID, Poster, Posted, Content) VALUES (NULL,'Welcome to bla','693','1','1186791378','This is the first thread in your new forum. You can disable this auto-greeting post by disabling the relevant option on the configure page.') in C:\Mypath\database.mysqli.inc on line 151.
vikingew’s picture

Latest dev version that have the fix is Aug 11, you probably download just before the packager ran (it takes some time from change is commited until d.o role it out). So I think best for you to do is to uninstall it, remove the uieforum dir and then add the new one from aug 11 and start over.

One thing though I am not sure of in this situation, there are a system varible with the last applied schema version, I don't know if drupal clear this automatically or not but I think so.

@zoro: I saw in your aug 11 commit this

) /*!40100 DEFAULT CHARACTER SET UTF8 */ ENGINE=MYISAM;"); --> ) DEFAULT CHARACTER SET UTF8;");

I tnk it need to be

) /*!40100 DEFAULT CHARACTER SET UTF8 */;");

or it wont play nice with different versions of mysql, hence I am not setting this back to fixed

webdrips’s picture

Just downloaded August 11, un-installed, re-installed and have the same issue.

Ran update.php for the heck of it but to no avail.

Note I forgot to mention I get a similar message when attempting to create a new thread.

If you need additional information, let me know...

vikingew’s picture

Did you really un-install it and not just deactivated it? You really need to use the uninstall feature of drupal or the old db tables and varibles will remain. If you really did uninstall, then probably the previously schema value in system didn't get reset.

webdrips’s picture

Yes I absolutely ran the un-install on the module.

If there is anything you would like me to try, let me know, but please be specific cuz I am a hack...

vikingew’s picture

Ok this is not my module you know, but I have a personal interest in it working as I want a good drupal fora and we all need to help each other - that's the spirit of this community :-)

And zoro is probably zzzzzz right now :-) So I am looking at it... with th ebest of my knowledge, but I am rather new to drupal as well. Do you have access to your mysql db? Do you know how to edit and upload a file to your drupal? ... and you do run 5.2 of drupal right?

vikingew’s picture

Status: Active » Fixed

I just did a fresh new install of the aug 11 dev version and it install and work as it should, no date problem. So I will set this back to fixed again.

Your problem is probably due to you first installed the previous not fixed version and haven't uninstalled properly, assuming you run Drupal 5.2

To properly uninstall do this. In Admin -> Site Building -> Modules, deavtivate UIEforum, then click the Uninstall Tab on top of module form. Select UIEforum for uninstall and submit. Note, you are not done yet as Drupal will ask you to confirm the uninstall, so you have to submit again. Now to be sure you have no stale files, remove dir sites/all/modules/uieforum and then transfer a new fresh copy of aug 11 version. Click the List Tab in modules to refresh, activate uieforum and so on.

daniel.hunt’s picture

Commented table settings fixed. Thanks.

vikingew’s picture

Actually you forgot the !40100 part in 2 places, I think this is important for compability between mysql versioons, like if you make a dump on one and then import to another.

daniel.hunt’s picture

Fixed ;)

Anonymous’s picture

Status: Fixed » Closed (fixed)
darumaki’s picture

Status: Closed (fixed) » Active

This problem still exists in the current version anyone find a fix ?

daniel.hunt’s picture

Status: Active » Postponed (maintainer needs more info)

Can you tell me exactly what you did to recreate this error? It has been idle for quite some time, and I have yet to see it happen again.

Daniel

daniel.hunt’s picture

Duplicate entered ( http://drupal.org/node/208252 ) of this bug - I can't think of anything that has changed that could be affecting this ...

Is your site timezone setup correctly?

darumaki’s picture

timezone is correct, what happens is on empty forums it displays 31 Dec 1969 - by guest, it shouldn't display anything if there are no posts yet,

daniel.hunt’s picture

Where does it display this, exactly?
I'm having trouble understanding you :)

darumaki’s picture

the initial forum display list think that's what its called. when you click on forum menu,

mscdex’s picture

That has always shown up for me too, displaying the 1969 date for forums with no threads in them yet.

daniel.hunt’s picture

Status: Postponed (maintainer needs more info) » Active

Ah I see now! I've never actually had this problem, as I have the system set (as it is by default) to create a "welcome" thread in every new forum!
I'll look into this - thanks

Greggus’s picture

I've got it working properly.

Change:
- file: uieforum.module
- function: _uieforum_GenerateForumRow
- line: 2416
- orignal code:
$lastreply = uieforum_parse_date($ThreadInfo->LastPost)."<br />dodał(a): ".theme('username', user_load(array('uid' => $ThreadInfo->uid)))." ".get_thread_link_text_last_post($ThreadInfo, _uieforum_icon(null, null, null, 'newpost.gif'));
- replace with:

	if (isset($ThreadInfo->LastPost)) {
		$lastreply = uieforum_parse_date($ThreadInfo->LastPost)."<br />dodał(a): ".theme('username', user_load(array('uid' => $ThreadInfo->uid)))." ".get_thread_link_text_last_post($ThreadInfo, _uieforum_icon(null, null, null, 'newpost.gif'));
		}
		else {
				$lastreply = t('n/a');
				}

Simply check if $ThreadInfo->LastPost exists and display date only if answer is yes.
Works fine for me.

I don't know if it will correct all yours problems but corrects date 1/1/1970 for empty forums.
Link - http://drupal.mhh.pl/forum

Cheers.

daniel.hunt’s picture

Status: Active » Fixed

Thanks for this, I've actually already fixed this in the new version of the module that I'm developing at the moment. But you're right, that's all you have to do to fix it :)

Daniel

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.