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

TOPIC:

Extend user table 05 Dec 2011 18:15 #666

  • gavinh
  • gavinh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
I have a table which basically extends the default Joomla user profile. One field is the Joomla user and the rest of fields are address, phone number, etc.

I'm trying to create a backend page (haven't started with the frontend) where I can edit individual user profile.


I have a form, where I can add all the fields in my table but can only add one field from the Joomla user table. Every time I try to drag another field from the Joomla user table, it doesn't appear in the form.

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Extend user table 05 Dec 2011 19:08 #668

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
You cannot extend tables yet. (Relation 1:1)

For the moment, the only possibility is N:1.
Means that your form cannot store datas in the foreign table.

You must rewite some lines :

You can create a copy of #__users table in order to hack it. But don't link it to your extended table. Build only a clone of the native Joomla table.

Build your layouts using the user FK (Cook native)

In your form, add the FK fields manually
In the controller, split the post in two parts and call 2 models

Easy, no ?
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: Extend user table 05 Dec 2011 22:03 #670

  • gavinh
  • gavinh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Thanks for the quick reply.

My apologies for not really understanding how to do the 'work around'. I'll have to spend some time googling and messing around with Cook.

What I think your saying is:
1. Create a table in Cook, which is the same as the Joomla User table.
2. Link the new table, using the foreign key to my extended profile table.
3. Build form using foreign key.
4. Manually hack the resulting code to update both the new table and the Joomla User table.

Easy? Yes, if I knew what I was doing. For me, not so easy, but I like a challenge.

Please Log in or Create an account to join the conversation.

Last edit: by gavinh.

Re: Extend user table 05 Dec 2011 22:49 #671

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
No, don't link nothing to the 'users' copy of Joomla native table.
Deals with Cook, as if you didn't have it.
Then, in your component, you'll get MVC to manage a 'users' table (just change the name inside table file)
This is the first step. With this MCV source code, you'll have all you want to manage and hack '#_users' DB.


In your form, you cannot insert users native fields because are behind FK.
So, in your form template source code, add some inputs (HTML, or JDom, as you want),

And finally, in the controller, do all the job to split the datas when storing.


Of course it is long to explain all the work you have to do. This is only a pattern. Then you will have to write.

I wrote a long post specially for you, and when I posted it, when session finished, I lost the text.
So boried to have to rewrite, I gave you a short answer.

Maybe tomorrow, I give you more precise help.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.060 seconds

  I found "cook" two days ago. Played around with it for a day and then within a day got rid of two legacy applications in IBM Lotus Domino Notes and replaced them with "cook". It was really easy. A piece of cake. Actually it was even easier than cooking. Cooking involves more work than developing with "cook". What can I say about "cook"? Great application great price for what it delivers great forum with a lot of information and fast responses active and friendly community fast forward moving development cycle So what should I say "Monsieur Le Cook"? Keep the good work going it will lead to success. Having become a paying member in the words of Edith Piaf may I say ..... non rien de rien ... je ne regrette rien. Vive La France.
FK (JED)
         

Get Started