Forums

Connectivity edit with Chronoforms , not retriving joomla user!

easy71 02 Nov, 2014
Hi,
I have read these instructions http://www.chronoengine.com/faqs/72-ccv5/5208-connectivity-edit-with-chronoforms.html
but I also need to find the user that making the change. I tried this custom code on load event:
<?php
$user =& JFactory::getUser();
$name = '';
$email = '';
if ( $user->id > 0 ) {
  $name = $user->name;
  $groups = $user->get('groups');
};
foreach($groups as $group);
$form->data['malttiaadmin[input_pic]'] = $name;
?>

and then i used a hidden filed with name malattiaadmin[input_pic] and value malattiaadmin[input_pic] but the field is not updated.
where am I wrong?
Thanks
Christian
GreyHead 03 Nov, 2014
Hi Christian,

Your PHP is a bit buggy, particularly the last couple of lines - but I'm not sure that you need any info about groups???

What information do you actually need here? If you want to save it in the database then ChronoForms automatically adds the user id to the modified_by column for you (if the column exists).

Bob
easy71 03 Nov, 2014
Hi Bob,
I need to find the name and not the id, and update the colum inpu_pic.
It's possible?

Thanks

Christian
GreyHead 06 Nov, 2014
Hi Christian,

I still don't understand quite what you need to do but this code should replace yours
<?php
$user = JFactory::getUser();
$name = '';
if ( $user->id > 0 ) {
  $name = $user->name;
};
$form->data['malttiaadmin[input_pic]'] = $name;
?>

Bob
This topic is locked and no more replies can be posted.