Hey,
I'm trying to make a standard contact form for my website.
In this, i would like to have following data:
[list]
Username
e-mail
message[/list]
Is there a way to pull the first 2 field from the joomla user tables? This way, the visitor doesn't need to put it in (maybe only change it on the contact form if he wants).
Hey,
Thanks for the quick response!
Seems it's that what I need.
I just can't figure out how to create a text field with a standard value the joomla username. And when it's not a user or not logged in, it should stay empty. And this field should be viewable since a non user should also be able to fill in the field.
But i'll give it another try tomorrow. Today i've seen to much computers... :wink:
Already thanks!!!
Hello,
If you place the code in a "Custom code" action before the "show html" and the form field name match the index in the data array then this should do it, e.g:
<?php
$user =& JFactory::getUser();
$form->data['user_email'] = $user->email;
?>
And set your field name to "user_email"
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
The "Custom code" action should be placed BEFORE the "Show html" action inside the "on load" event in your "form wizard".
Did you try that ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
HI brononius,
This will only work if the user is logged in.
You probably want their $user->email and not the $user->username
Other than that the code you posted looks OK to me.
Bob
Okay, found what I was doing wrong.
I configured the form by the backend and tested it with the button "test form".
And since i wasn't logged in on the frontend, i didn't see the data. 🙄
So your tip was helpfull!
And the remark about email/username was also correct. Not the problem, but details can do a lot.😉
I can start to build the forms now.
Btw payment is on the way...