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.058 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started