Hi there
I'm using the profile plugin to get data (email and name) from jos_users.
But I need some extra info from jos_comprofiler (eg cb_company) to load in the form when members want to register for an event.
Is it possible to get data from 2 tables by duplicating the profile plugin? Or another way?
Thanks
Luc
I'm using the profile plugin to get data (email and name) from jos_users.
But I need some extra info from jos_comprofiler (eg cb_company) to load in the form when members want to register for an event.
Is it possible to get data from 2 tables by duplicating the profile plugin? Or another way?
Thanks
Luc
Hi vandereyde,
The Profile Plugin is only designed to work with one table :-(
But you can hand-code a form to get pre-load data from any number of tables. You add the MySQL queries at the front and set the input values from the data.
Bob
The Profile Plugin is only designed to work with one table :-(
But you can hand-code a form to get pre-load data from any number of tables. You add the MySQL queries at the front and set the input values from the data.
Bob
thanks Bob.
But were exactly do I put the mysql queries? Is there a special field for this?
But were exactly do I put the mysql queries? Is there a special field for this?
Hi vandereyde,
Add them inside <?php . . . ?> tags at the start of the Form HTML. You need to use some Joomla PHP code to set them up. There are many, many examples in the forums here if you search on 'query'
Bob
Add them inside <?php . . . ?> tags at the start of the Form HTML. You need to use some Joomla PHP code to set them up. There are many, many examples in the forums here if you search on 'query'
Bob
Great, thanks Bob. I'll do some searching.
luc
luc
Hi Bob
I did some searching and came up with a script I can use.
This echos my cb_name field on top of the form. But now I want this field to be shown as a value in a formfield, like this:
But this way it doesn't show. Is there a way?
luc
I did some searching and came up with a script I can use.
<?php
$user =& JFactory::getUser();
$id=$user->id;
$q="SELECT cb_name
FROM jos_comprofiler
WHERE jos_comprofiler.user_id = '$id'";
$r=mysql_query($q);
while ($r2=mysql_fetch_array($r))
{
echo "<h4>Your name is " .$r2[cb_name] ."</h4>";
}
?>
This echos my cb_name field on top of the form. But now I want this field to be shown as a value in a formfield, like this:
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Company</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_15" name="company" value="{cb_name}" type="text" />
But this way it doesn't show. Is there a way?
luc
Hi vadereyde,
Please try value="<?php echo $r2['cb_name']; ?>"
And better to use the Joomla db code
Bob
Please try value="<?php echo $r2['cb_name']; ?>"
And better to use the Joomla db code
<?php
if ( !$mainframe->isSite() ) { return; }
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$q = "SELECT `cb_name`
FROM `#___comprofiler`
WHERE `user_id` = ".$user->id."; ";
$db->setQuery($q);
$r2 = $db->loadResult();
echo $r2['cb_name'];
?>
I'm assuming this will be a unique result.Bob
This topic is locked and no more replies can be posted.