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

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
Heatherx
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 119
Joined: Mon Sep 28, 2009 10:03 am

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

Post by Heatherx » Sun Mar 07, 2010 9:11 pm

I need to post date my articles so is there a way to edit the creation date of a joomla article?

User avatar
esedic
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 145
Joined: Wed Dec 27, 2006 1:55 pm
Contact:

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

Post by esedic » Sun Mar 07, 2010 10:14 pm

Of course, you can easily set creation date of the article to whatever date you wish.
Btw, have you already installed Joomla? :)
https://www.spletodrom.si| Izdelava spletnih strani

gregbanig
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Sun Aug 09, 2009 8:30 pm
Location: San Diego, CA
Contact:

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

Post by gregbanig » Mon Mar 08, 2010 2:16 am

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.

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Sun Mar 14, 2010 12:45 am

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
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26197
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

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

Post by Per Yngve Berg » Sun Mar 14, 2010 9:38 am

Run this SQL:

Code: Select all

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

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Sun Mar 14, 2010 11:54 am

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`;
You do not have the required permissions to view the files attached to this post.
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26197
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

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

Post by Per Yngve Berg » Sun Mar 14, 2010 12:28 pm

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

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Sun Mar 14, 2010 1:26 pm

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
You do not have the required permissions to view the files attached to this post.
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26197
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

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

Post by Per Yngve Berg » Sun Mar 14, 2010 1:57 pm

Use the hole SQL sentence:

Code: Select all

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

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Sun Mar 14, 2010 8:36 pm

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`;
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26197
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

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

Post by Per Yngve Berg » Sun Mar 14, 2010 8:50 pm

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).

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Sun Mar 14, 2010 9:09 pm

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).
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26197
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

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

Post by Per Yngve Berg » Sun Mar 14, 2010 9:37 pm

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.

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Mon May 24, 2010 7:58 pm

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
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 26197
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

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

Post by Per Yngve Berg » Tue May 25, 2010 7:32 am

Change the feed itself. components\com_content\views\frontpage\view.feed.php

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Tue May 25, 2010 1:32 pm

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
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.

lowtech
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Tue Jan 06, 2009 9:39 pm

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

Post by lowtech » Tue May 25, 2010 2:03 pm

Per,

It's fixed!

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

Thanks again,

Lowtech
That one may smile and smile, and be a villain.
-Wm. Shakespeare, Hamlet, Act 1, Sc. 5.


Locked

Return to “Administration 1.5”