Hi,
I've made some custom user profile fields "phone" and "mobile" using the Joomla 2.5 profiles plugin.
Info on this is here..
http://docs.joomla.org/Creating_a_profile_plugin
After playing with the model prepareQuery (com_mycomponent/models/myform.php ) - I can read the user profile data - but I cannot save it back into #__user_profiles. Its the nature of the SQL query I've written - it defaults back to saving the profile data into my dummy JCook table instead of #__user_profiles.
You see, the #__user_profiles table does not have a column for every field type. Instead its a simple 4 column table that stores the user_id, profile_key, profile_value and order.
My customised code...
protected function prepareQuery(&$query, $pk)
{
....
//SELECT - added fields from the user profile table
$this->addSelect('_user_profiles_phone_.profile_value AS phone');
$this->addSelect('_user_profiles_mobile_.profile_value AS mobile');
...
//JOIN - join the user profile table
$this->addJoin('`#__user_profiles` AS _user_profiles_phone_ ON _user_profiles_phone_.user_id = a.joomla_user AND _user_profiles_phone_.profile_key = "profile.phone"', 'LEFT');
$this->addJoin('`#__user_profiles` AS _user_profiles_mobile_ ON _user_profiles_mobile_.user_id = a.joomla_user AND _user_profiles_mobile_.profile_key = "profile.mobile"', 'LEFT');
Has anyone used the prepareQuery SQL to write back to #__user_profile? If so - what SQL statements did you use?
As a workaround I'm manually saving the user_profile data in the model's public function save($data).