Hi Robin,
this is the code to get the profile information from the database. This in only one step in the right direction.
You have to change at least the following two Visforms core files
adminstrator/components/com_visforms/models/forms/visfield.xml
components/com_visforms/lib/field/text.php
In the xml file you have to add an Option for each profile information you want to use in the xml node "field" with the name attribute "f_text_fillwith".
Code:
<field name="f_text_fillwith" type="list"
label="COM_VISFORMS_FILL_FIELD_WITH" description="COM_VISFORMS_FILL_FIELD_WITH_DESC"
class="inputbox" default="0">
<option value="0">COM_VISFORMS_INITIAL_VALUE</option>
<option value="1">COM_VISFORMS_CONNECTED_USER_NAME</option>
<option value="2">COM_VISFORMS_CONNECTED_USER_USERNAME</option>
</field>
Like
Code:
<option value="3">Addr1</option>
In the php file you have to adapt the function setFieldDefaultValue()
Basically you have to add a new if statement in the following part of the code for each option which you have added to the xml file.
Code:
if ((isset($field->fillwith) && $field->fillwith != ""))
{
$user = JFactory::getUser();
$userId = $user->get('id');
if($userId != 0)
{
if($field->fillwith == 1)
{
$this->field->attribute_value = $user->get('name');
return;
}
if($field->fillwith == 2)
{
$this->field->attribute_value = $user->get('username');
return;
}
}
}
Like
Code:
if($field->fillwith == 3)
{
//get addr1 from profile
return;
}
I think this should do the trick, but this is absolutely untested and without any guarantee.
Regards,
Aicha