It is beacause you work on RS!Forms Pro Maybe, the script doesn't fonctionned on RS§Forms >Pro because, they can't used the $fields var from class SManager. So you are chocolate ^^
or try this :
It's the same think like this :
http://www.rsjoomla.com/index.php/RSform-Scripts/3493-RePre-fill-Name-email-address-if-user-is-lo.html#3493
but with CB data fields, so
Assign an only crazy value like this one : *-*-* into the Default Value of the input you want pre-filled.
and paste this code :
$my = & JFactory::getUser();
if($my->id){
$database->setQuery(\"SELECT * FROM #__comprofiler_fields WHERE user_id = {$my->id}\"«»);
$cb_fields = $database->loadObjectList();
$formLayout = str_replace(\"*-*-*\", cb_fields->name, $formLayout);
}
Else {
$formLayout = str_replace(\"*-*-*\", \"Insert here your name\", $formLayout);
}
Explain of my test :
- I defined $my with the user information array
- If user is connected :
- Build the mysql query with field of connected people
- I replace the defaut value by the value take of the row \"name\" from my array
- Else
- I replace the defaut value by the value of my choice
Don't forget to log on front end.
I can't test them because i don't want the CB component . But maybe it will be ok, it have fonctionne with the original users table from joomla. if there is a problem it's came from the mysql query becaus i don't know the tree of mysql database with CB Component.
Alex, please, build an alone section for RS!Foprms Pro, it is very useful, we can't be up on this new component if we used RS!Forms Lite script. An you will have less same message of non fonctionned.
<br><br>Post edited by: dragonjc, at: 2008/07/01 21:43