Form to Update #_user_profiles

talkinggoat

Member
I have built an advanced user registration form that includes addresses and I want the address information to show up in the Joomla back-end. The issue is, the table that contains all the "user profile" information, (named user_profiles) such as Address, City, State, etc, just has all that information dumped into the table, indexed by the User's ID (user_id profile_key, profile_value, ordering).
VATJAHP.png


Can someone point me in the right direction as to how I would write that information into the submission of a form? How would I make an element called "Address" write data to a mySQL table, where ordering is "1", profile_key is "profile.address1" and the "user_id" is the ID of the user that's signing up? I am sure I could make an SQL script to write the address and order, but what about the ID? And where would I even put the script so Fabrik would know, this element, called address, writes its data to the field user_profiles when I don't know the user_id? It doesn't seem like a simple join would work, here.
 
Last edited:
I found this in the wiki and it seems like it might be the right track, but how do I get the user_id of the person registering and how do I insert the data in the field into the "profile_value" row? Do I just put this into the php of the element that's doing the submitting and replace tablename___elementname with the element doing the submitting?

PHP:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->insert('tablename')->set('field = ' . $db->quote('bar'))
->set('field2 = ' . $db->quote('{tablename___elementname}'));
$db->setQuery($query);
$db->execute();
$id = $db->insertid();

// Update form data with insert id
$formModel->updateFormData('tablename___elementname2', $id);
 
I'm no friend of these J! user_profile stuff.
Is it necessary to use exactly this table?
I think it's easier to put all these elements in a Fabrik registration form so you get all what you need in one user record.
 
@troester Would that be using the #_user table, in the J! database, as a list in Fabrik, then joining it to the list that holds the remaining Fabrik registration data?

It seems like a Fabrik list would be the easier option to store profile info, but if it's too much of a pain in the ass to write stuff to the J! profile table, I'll list all the profile stuff in Fabrik and worry about the J! table, later.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top