Page 1 of 1

Is it possible to change the creation date of an article?

Posted: Sun Mar 07, 2010 9:11 pm
by Heatherx
I need to post date my articles so is there a way to edit the creation date of a joomla article?

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 07, 2010 10:14 pm
by esedic
Of course, you can easily set creation date of the article to whatever date you wish.
Btw, have you already installed Joomla? :)

Re: Is it possible to change the creation date of an article?

Posted: Mon Mar 08, 2010 2:16 am
by gregbanig
Couple of ways to do this.

1) Joomla admin, article manager, article. Edit the created date.

2) Edit in phpmyadmin.

Option 1 is much easier unless you are looking to update a lot of articles at once.

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 12:45 am
by lowtech
I have a similar problem. I would much prefer to show the publication date rather than the creation date to the public. Sometimes articles are created weeks before they are posted.

How can one do this for all articles on the site all at once?

Is there a php fix?

Thanks,

Lowtech

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 9:38 am
by Per Yngve Berg
Run this SQL:

Code: Select all

update `jos_content` set `created`=`publish_up`;

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 11:54 am
by lowtech
Thanks for the reply, Per!

Since I have never worked in SQL before, I am having some difficulty.
Whatever I try, I either get no changes or my content disappears when I add single quotes (') and I get these two messages:

Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/testbed/components/com_content/models/frontpage.php on line 104

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/testbed/libraries/joomla/database/database/mysql.php on line 344

I attach a screenshot of the MySql page for 'created.'

Possibly you could expand a bit on your instruction?

Thank you,

Lowtech


Per Yngve Berg wrote:Run this SQL:

Code: Select all

update `jos_content` set `created`=`publish_up`;

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 12:28 pm
by Per Yngve Berg
You are making a new field in the jos_content table. That is not what you are supposed to do.

Goto the SQL tab
Paste in the SQL code in the "Run SQL query/queries on database" replacing the select statement that's already there.
Click Go

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 1:26 pm
by lowtech
OK, Per

I tried to do what you said, but I am not there yet.
When I hit "go" I got a SQL error. See attached screen shot.
I am a bit lost.

Best,

Lowtech
Per Yngve Berg wrote:You are making a new field in the jos_content table. That is not what you are supposed to do.

Goto the SQL tab
Paste in the SQL code in the "Run SQL query/queries on database" replacing the select statement that's already there.
Click Go

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 1:57 pm
by Per Yngve Berg
Use the hole SQL sentence:

Code: Select all

update `jos_content` set `created`=`publish_up`;

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 8:36 pm
by lowtech
Well, Per, I tried!

I installed this language:
update `jos_content` set `created`=`publish_up`;

Then I got this yellow warning message across the top of the SQL panel:

#1062 - Duplicate entry "2009-03-05 14:00:00' for key 2

I don't know if it is a fatal message nor do I know where to look for
"key 2."

But at the frontend the dates have not changed to the published dates.

Perhaps I am overlooking something? Should I be doing something different for "frontpage" content? I am lost! :(

Thanks,

Lowtech


Per Yngve Berg wrote:Use the whole SQL sentence:

Code: Select all

update `jos_content` set `created`=`publish_up`;

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 8:50 pm
by Per Yngve Berg
It stopped while you can not have two articles with the same time because of the unique key.

Goto structure and Details at the bottom of the page. I do not have a key for the created field in my installation. Edit it and set unique to no (indexed).

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 9:09 pm
by lowtech
Bingo!!! :) It's working :)

Much thanks!

One minor additional question:
Is there a way to alter the default date layout in the whole website or by section, etc in MySQL? Don't need the day of the week and prefer the US date sequence of month, day, year, if only because I am surrounded by that sequence in all day to day activities and I suspect many site viewers will also be challenged.

Thanks much,

Lowtech

By the way, where I come from, Minnesota and Wisconsin, I think there are
more people of Norwegian descent than anywhere outside Norway. When I was a student, I worked for a judge named Lincoln Neprud. He could not lose an election! :)
Per Yngve Berg wrote:It stopped while you can not have two articles with the same time because of the unique key.

Goto structure and Details at the bottom of the page. I do not have a key for the created field in my installation. Edit it and set unique to no (indexed).

Re: Is it possible to change the creation date of an article?

Posted: Sun Mar 14, 2010 9:37 pm
by Per Yngve Berg
Glad it worked out for you.

You cannot set the format of the date in the database itself, but are controlled by the application viewing the dates. Joomla will use the settings on the user if logged in. Otherwise use the setting of the webserver.
lowtech wrote:By the way, where I come from, Minnesota and Wisconsin, I think there are
more people of Norwegian descent than anywhere outside Norway.
You are absolutely right. Neprud is not a very common name. I found 19 Neprud and 22 Næprud in the Norwegian Phone Directory.

Re: Is it possible to change the creation date of an article

Posted: Mon May 24, 2010 7:58 pm
by lowtech
Further Question :)

The MySql update to make the creation date equal the publish_up date works for all pages already in the db. It would be nice if something in the php could be changed so all future articles would automatically show the same dates.

Here is the background: Twitter and like feeds track front pages only. They show the articles by creation date. The most recent article may have been created earlier than the other articles shown and the early creation date causes it to appear at the bottom of the Twitter list and subscribers might not see it. Since feeds are becoming a factor it might be nice to automatically show newest at the top. Hence the need to make the creation and publish_up dates the same. And there is so much to do every day that a hard coded solution seems like the way to go.

I took a look at components/com_content/models/frontpage.php

and I am guessing the fix may lie here. But I am php challenged!

Any further suggestions (with code!!) will be appreciated.

Best,

Lowtech

Re: Is it possible to change the creation date of an article

Posted: Tue May 25, 2010 7:32 am
by Per Yngve Berg
Change the feed itself. components\com_content\views\frontpage\view.feed.php

Re: Is it possible to change the creation date of an article

Posted: Tue May 25, 2010 1:32 pm
by lowtech
Thanks Per!

But of course it didn't work for me the way I did it. :-[
I changed it to look like this:
$item->date = $row->publish_up; // was 'created;'

I also changed author email to equal site email. And the feeds stopped working!

The error message said there was a parsing error in line 71b where I had changed author email to site email. (What is "71b"? In "code editing" in cPanel each line is given a number, not number-letter combinations.)

So I replaced the feed.php file from the vault and it came back to normal.

Any suggestions? Step by step approach? Is "publish_up" the correct syntax?

Thanks,

Lowtech



Per Yngve Berg wrote:Change the feed itself. components\com_content\views\frontpage\view.feed.php

Re: Is it possible to change the creation date of an article

Posted: Tue May 25, 2010 2:03 pm
by lowtech
Per,

It's fixed!

I redid it, changing date from 'created' to 'publish_up'
with no other changes.

Thanks again,

Lowtech