The created (created_time), modified_by, modified (modified_time) are not populated/updated

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Post Reply
nkamp
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Wed Mar 08, 2006 7:20 am

The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by nkamp » Mon Nov 23, 2020 9:27 pm

Hello,

I'm busy with a custom component and I want to show the user the four fields:
  • created_by
    created (or created_time)
    modified_by
    modified (or modified_time)
If I save the details page (edit.php), than these values are not updated in the database. I have tried this with defining these fields in the <form>.xml and without defining these fields.

My question is, are these fields saved by default or not?
And if I want to modify the value's for a certain reason, were can I do this? In one of the methods of the tables file?

I've been looking at com_categories and com_content but I can't find it how and were these fields are maintained.

Nico

annahersh
Joomla! Guru
Joomla! Guru
Posts: 734
Joined: Wed Aug 15, 2018 8:23 pm

Re: The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by annahersh » Tue Nov 24, 2020 1:10 am

nkamp wrote:
Mon Nov 23, 2020 9:27 pm
My question is, are these fields saved by default or not?
Yes the fields are saved default.

To change the values, click the tab labeled Publishing when posting an article
content-dates.jpg
You do not have the required permissions to view the files attached to this post.

nkamp
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Wed Mar 08, 2006 7:20 am

Re: The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by nkamp » Tue Nov 24, 2020 9:37 pm

Ok, I’m doubting.
I’m busy to make a custom component and I have made views, but the fields created (or created_time), modified_by and modified (or modified_time) are not populated in the database. Created_by is populated in the database, if I do not define as read only in <form>.xml.

Make no difference if I define the fields in the <form>.xml or not, in both situations the values are not set in the database.

And if I define the fields in the <form>.xml as read only, the fields are in $data array but without value! I don’t understand why.
Or the fields modified_by/modified are filled somewhere in the code after the user has pressed ‘save’, but we’re? I can’t find we’re it is done at com_content/com_categories.

I try to find were the record is saved. I suppose that thre is somewhere an ‘insert’ or ‘update’ statement. I’m expecting in jmodeladmin, but till now I couldn’t find it.

annahersh
Joomla! Guru
Joomla! Guru
Posts: 734
Joined: Wed Aug 15, 2018 8:23 pm

Re: The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by annahersh » Wed Nov 25, 2020 2:17 am

nkamp wrote:
Tue Nov 24, 2020 9:37 pm
I’m busy to make a custom component
I assume this means you are developing a component. Is a database table included? If yes, your form will need to send data to columns included within your table - `modified_by`, `created_by` and the other columns.

Are you fully capable of component writing? If not, see https://docs.joomla.org/J3.x:Developing ... _Component

nkamp
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Wed Mar 08, 2006 7:20 am

Re: The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by nkamp » Thu Nov 26, 2020 9:42 am

Hello,

I'm following the tutorials of Robbie Jackson. At this moment I have not seen all of them, but I'm following these.

Although it's a thread of 2012 I have found viewtopic.php?t=750048.

And someone send an example from his component to show me something else, and I saw there that he put these in the function check. But it doesn't work as expected.

I have added this, and now these fields are populated in the database!!!

So I'm still doubting if these fields are populated by default! And I'm agree with all of you, I can't find this for the com_content or com_categories.
So it is still not clear how it should work or what the default behavior is for these fields.

Nico.

annahersh
Joomla! Guru
Joomla! Guru
Posts: 734
Joined: Wed Aug 15, 2018 8:23 pm

Re: The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by annahersh » Thu Nov 26, 2020 11:48 pm

Is your component attempting to store data withing the _content table or its own table? Please clarify where the data is being sent.

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

Re: The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by Per Yngve Berg » Fri Nov 27, 2020 8:17 am

Mod. note: Relocated the topic from Extensions to the Coding Forum.

nkamp
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Wed Mar 08, 2006 7:20 am

Re: The created (created_time), modified_by, modified (modified_time) are not populated/updated

Post by nkamp » Wed Dec 02, 2020 9:29 pm

I thought that it was clear that I have written in first message that I'm building a custom component. That said I thought that it is clear that the data is written to own tables.

Everything is custom made and the basic is from the book "Learning Joomla 3 Extension Development".

But in this particular case I'm looking at com_content and com_categories how they did it, but that is not clear to me.

But what is does it make the difference if it is written to com_content table or to a custom table?


Post Reply

Return to “Joomla! 3.x Coding”