Welcome, Guest
Username: Password: Remember me

TOPIC: Extend user table

Extend user table 05 Dec 2011 18:15 #666

  • gavinh
  • gavinh's Avatar
  • Offline
  • New Member
  • Posts: 9
  • Karma: 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.
Last Edit: 05 Dec 2011 19:10 by admin.
The administrator has disabled public write access.

Extend user table 05 Dec 2011 19:08 #668

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
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
The administrator has disabled public write access.

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

  • gavinh
  • gavinh's Avatar
  • Offline
  • New Member
  • Posts: 9
  • Karma: 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.
Last Edit: 05 Dec 2011 22:04 by gavinh.
The administrator has disabled public write access.

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

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
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
The administrator has disabled public write access.
Time to create page: 0.105 seconds

Get Started