Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: [CLOSED] "Created By" does not function correctly

"Created By" does not function correctly 04 Jul 2013 05:43 #7853

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Sometimes it works, and sometimes it doesn't. If I totally delete the page and recreate it, it might work ... sometimes.

I will explain my component. It is rather basic:

Tables:
- Encoders
- Products
- Licenses

Encoders: a definition of encoders used to encrypt PHP licenses. Very basic table.

Products: The different kind of licenses. There is one foreign key to Encoders.

Licenses: The license key created for the user. There is one foreign key to a Product.


Licenses - Admin View
I have one collection and two items here. The collection views all licenses with basic info. The two items are Create Key and View Key.

Create Key
In the Licenses table I used the Author Wizard to add Created By. This is the field I use here to assign it to the user. Even in the j-Cook sandbox the item I am creating gets assign back to me. (The admin creating the item.) I have seen it work correctly once in the sandbox.


So, I go back and delete the pages to start over. I swear, I have rebuilt this component 15 times. This is frustrating as hell since it worked great in j-Cook v2.0. I am also being bombarded by Fatal Errors in the builder with things like 2!=4 when I try to build a form or fly.
--
Jerry Benton
The administrator has disabled public write access.

"Created By" does not function correctly 04 Jul 2013 07:36 #7855

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
So I just deleted all of the Licenses pages and table. Recreated everything. Same thing.

Created_By = Super User

I guess I will totally start over with a new project and see how that goes.
--
Jerry Benton
The administrator has disabled public write access.

"Created By" does not function correctly 04 Jul 2013 14:44 #7865

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Ok, so I just totally recreated an entirely new project.

Does not work.

The name of the project is "Key Man" if you wan to take a look.
--
Jerry Benton
The administrator has disabled public write access.

"Created By" does not function correctly 04 Jul 2013 17:00 #7866

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
So yeah ...

When creating a new record, it always saves as the admin creating the record. However, if you edit the record, change it to the user, and then save again it functions correctly. So, something, somewhere, somehow during the creation of a new record is either killing or ignoring the "Created By" field.

I am guessing something in the code like this is doing it. Ideas?


		//Secure the author key if not allowed to change
		if (isset($data['created_by']) && !$acl->get('core.edit'))
			unset($data['created_by']);
--
Jerry Benton
The administrator has disabled public write access.
The following user(s) said Thank You: admin

"Created By" does not function correctly 04 Jul 2013 17:19 #7867

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
I commented all of the above items out and tried again. Still doesn't work. So, it is not that block of code doing it.


Ideas? Admin?
--
Jerry Benton
The administrator has disabled public write access.

"Created By" does not function correctly 04 Jul 2013 17:55 #7869

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Yes
Thank you very for all precisions.
I am actually working on another issue.
And will fix it as soon as possible. (High priority)
Coding is now a piece of cake
The administrator has disabled public write access.

"Created By" does not function correctly 04 Jul 2013 19:39 #7871

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I can see you have instancied Created By in your form.
You can eventually do that if you want to be able to change the Author of the item.
But, DO NOT MAKE IT REQUIRED !

When you leave the Created By field empty, it works.
When you choose another author it works also.
When you edit, the author is not modified if you do not touch it.

Well, it works perfectly for me.
Remove the required property on Created By, then try it again, leaving the combo box empty in the form.
I cannot see any problem on a fresh Joomla install either.
I don't understand your problem right now.
Coding is now a piece of cake
The administrator has disabled public write access.

"Created By" does not function correctly 04 Jul 2013 23:04 #7878

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
It was set as not required. I changed it to test. It did not work either way.
--
Jerry Benton
The administrator has disabled public write access.

"Created By" does not function correctly 31 Jul 2013 10:16 #10644

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Is is working better now ?
Because I have made o lot of changes in ACL.

I cannot reproduce your problem.
Coding is now a piece of cake
The administrator has disabled public write access.

"Created By" does not function correctly 31 Jul 2013 14:27 #10648

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
I just back from a business trip. i will try and test my component this evening. I will post the results.
--
Jerry Benton
The administrator has disabled public write access.

"Created By" does not function correctly 31 Jul 2013 14:44 #10649

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
I just ran an initial test. I am still seeing the same behavior. (The admin user is the "created by" when creating a new key.)

Is there something I am doing wrong here? The project is called LKM if you would like to take a look.
--
Jerry Benton
The administrator has disabled public write access.

"Created By" does not function correctly 05 Aug 2013 14:46 #10681

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I have answered you in your other post.
Created By is automatic authoring, so you do not need to choose the user.

Try this feature changing the virtual user of the sandbox.
In your Joomla, you need to log in with another user to try.
And please remove the 'Created By' from your forms (at least for the tests)

If you still have problems, please send me your component because I cannot reproduce.
I will close your 2 tickets soon.
Coding is now a piece of cake
The administrator has disabled public write access.

"Created By" does not function correctly 05 Aug 2013 17:15 #10683

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Ok, I think I am doing this in an outdated manner: Last year I had this problem:

- I need the user to only see his items on the front end.

To accomplish this I was told to do this:

- Use "Created By" instead of "Joomla User".
- Set "View Own" in the ACL.

This allowed me to create an item on the back end for a user and only that user can view the item on the front end. Has this changed?
--
Jerry Benton
Last Edit: 05 Aug 2013 17:16 by jcbenton.
The administrator has disabled public write access.

"Created By" does not function correctly 05 Aug 2013 17:59 #10685

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Ok, you can do that, but first create it.
(Admin will be the owner)

And then edit it again to specify the user, with the create_by in the form eventually, but first test in the normal way.

If you want to be able to set the created_by in the form directly in the 'New' item (id=0), then you need to fork your ITEM MODEL / function : prepareTable()
//Defines automatically the author of this element
if (empty($table->created_by)) //ADD THIS
	$table->created_by = JFactory::getUser()->get('id');
Coding is now a piece of cake
The administrator has disabled public write access.

"Created By" does not function correctly 05 Aug 2013 18:01 #10686

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Is there a more preferred method? Such as limiting the select to the user id? Which would be better?
--
Jerry Benton
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.076 seconds

Get Started