I have 2 categories of users who will fill in the created form, guests and registered users.
If a registered user has logged in, how can I then copy his (CB)_fields into the fields of the form as default values.
From the registered users, the name, address etc are already stored in the database, and it would be nice if these values would already been filled in as default in the requested fields.
Another option would be that those (for guest required) fields where not shown in the field.
Thanks for you help.
Patrick
If a registered user has logged in, how can I then copy his (CB)_fields into the fields of the form as default values.
From the registered users, the name, address etc are already stored in the database, and it would be nice if these values would already been filled in as default in the requested fields.
Another option would be that those (for guest required) fields where not shown in the field.
Thanks for you help.
Patrick
Hi Patrick,
I would write a little code at the beginning of the Form HTLP to check the user ID, look them up in the user & CB_User tables and set default values for the form fields depending on what is found.
Bob
I would write a little code at the beginning of the Form HTLP to check the user ID, look them up in the user & CB_User tables and set default values for the form fields depending on what is found.
Bob
Thanks Bob,
problem is that I am not yet so familair with this code and learning it. (As might have noticed🙂
Meanwhile I found this Topic and changed my code in this way :
It is however only working for the emailfield.
Do you have example on how I could set this up ?
Many thanks,
Patrick
problem is that I am not yet so familair with this code and learning it. (As might have noticed🙂
Meanwhile I found this Topic and changed my code in this way :
<DIV class="form_item">
<DIV class="form_element cf_textbox" ><LABEL class="cf_label" >Voornaam </LABEL><INPUT class="cf_inputbox required" id="voornaam" maxLength="150" size="30" name="voornaam" type="text" value="<?php $user = &JFactory::getUser();echo $user->firstname;?>"></DIV>
<DIV class="clear" >Â </DIV>
</DIV>
<DIV class="form_item">
<DIV class="form_element cf_textbox" ><LABEL class="cf_label">tussennaam </LABEL><INPUT class="cf_inputbox " id="tussennaam" maxLength="150" size="30" name="tussennaam" type="text" value="<?php $user = &JFactory::getUser();echo $user->middlename;?>"></DIV>
<DIV class="clear" >Â </DIV>
</DIV>
<DIV class="form_item">
<DIV class="form_element cf_textbox" ><LABEL class="cf_label">Naam </LABEL><INPUT class="cf_inputbox required" id="naam" maxLength="150" size="30" name="naam" type="text" value="<?php $user = &JFactory::getUser();echo $user->lastname;?>"></DIV>
<DIV class="clear" >Â </DIV>
</DIV>
<DIV class="form_item">
<DIV class="form_element cf_textbox" ><LABEL class="cf_label" >Adres </LABEL><INPUT class="cf_inputbox required" id="adres" maxLength="150" size="30" name="adres" type="text" value="<?php $user = &JFactory::getUser();echo $user->address;?>"></DIV>
<DIV class="clear" >Â </DIV>
</DIV>
It is however only working for the emailfield.
Do you have example on how I could set this up ?
Many thanks,
Patrick
Hi Patrick,
First off, you only need the JFactory line once
Second, the Joomla user object doesn't know about first_name and last_name, only name, and it doesn't know about address at all.
These items may be in the CB_user table or somewhere else, you'll need to find them and look them up.
Bob
First off, you only need the JFactory line once
<?php
$user = &JFactory::getUser();
?>
Then you can use $user wherever it is needed.Second, the Joomla user object doesn't know about first_name and last_name, only name, and it doesn't know about address at all.
These items may be in the CB_user table or somewhere else, you'll need to find them and look them up.
Bob
Thanks Bob,
that is indeed correct. These fields are all in the jos_comprofiler table.
How can I connect to this table and use the fields of this table?
Is there a HowTo on how to work with the CB_Plugin ?
I just found this thread : http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=9&t=11106 and working it out. I will edit this post later, when I am finished.
Thanks
Patrick
that is indeed correct. These fields are all in the jos_comprofiler table.
How can I connect to this table and use the fields of this table?
Is there a HowTo on how to work with the CB_Plugin ?
I just found this thread : http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=9&t=11106 and working it out. I will edit this post later, when I am finished.
Thanks
Patrick
This topic is locked and no more replies can be posted.