Hi All!
I apologize for the post, but I have been unable to make the getuser() work and have looked for a full demo, not just bits of code to guide me.
Currently, I am trying to add the logged in user id and name to a table and use it in an email once I submit a form. I have read the FAQ's and searched getuser in the forums and have not been able to get the code to work. I have attached screen shots to show what I have done so far.
I have added to the onload section the custom code:
I have a text boxe's with the id's: 'id' and 'name'
When I run the code shown above, nothing populates, but if a put an id in, the text boxe's populate.
What am I missing?
Any input would help, I have everything else working on my form, but this last bit.
Thanks!
Colleen
I apologize for the post, but I have been unable to make the getuser() work and have looked for a full demo, not just bits of code to guide me.
Currently, I am trying to add the logged in user id and name to a table and use it in an email once I submit a form. I have read the FAQ's and searched getuser in the forums and have not been able to get the code to work. I have attached screen shots to show what I have done so far.
I have added to the onload section the custom code:
<?php
$user = \JFactory::getUser();
$form->data['id'] = $user->id;
$form->data['name'] = $user->name;
?>
I have a text boxe's with the id's: 'id' and 'name'
When I run the code shown above, nothing populates, but if a put an id in, the text boxe's populate.
What am I missing?
Any input would help, I have everything else working on my form, but this last bit.
Thanks!
Colleen