Forums

How to include username in email template when not asked?

UHU 06 Sep, 2008
Hello,

I have created a form and I would like the form to forward all form field information along with user name.
The user name will not be requested in the form.
It must be added in the email template separately.
Only people who are logged in will find a link to this form.
Is this possible?

Also is it possible to make a form private or viewable only to registered people?

Thank you,

L.
UHU 06 Sep, 2008
Hello,

I got a reply to my first question in your FAQs.
I just needed to add a from email and a from name.

I still don't know
if it is possible to make a form private or viewable only to registered people?

Thanks,

Laure
Max_admin 06 Sep, 2008
Hi Laure,

please search the forums for "registered users only", you should find examples on how to implement this feature, let me know if you cant find them!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
UHU 08 Sep, 2008
I looked around the forum and I found something like this

<?php
$user = &JFactory::getUser();
if(!$user){return;}
?>
<?php
$user;
?>
<input type="text" name="email" value="<?php echo $user->email; ?> 


I have no idea how to make it correct.

A bit is to restrict access and the other to send the user email address with the form
I added
My e-mail:{email}

to my email template.
Of course it doesn't work and I don't even receive emails to my mail box.

I'm on Joomla 1.5
and my server is on PHP5.2.1

Please help,

L.
Max_admin 08 Sep, 2008
Hi Laure,

at the top of your form add this :

<?php
$user = &JFactory::getUser();
if(!$user->id){return;}
?>


this way your form is restricted to registered!

then add this in the form code :
<input type="text" name="email" value="<?php echo $user->email; ?> 


the email field will be loaded with logged in user email!

and use the My e-mail:{email} in the template, that's correct!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
UHU 09 Sep, 2008
Hello Max,

Thank you. I did what you said but this solution forces me to display the email of the registered person.
Is there a way to include the email value in the form without displaying it? I tried CSS
and javascript.

 function hide() {
     document.getElementById("email" ).style.visibility = "hidden"
}


It doesn't work.

Please help,

L.
UHU 09 Sep, 2008
Hello again,

The visibility problem is solved. I just changed the input type to hidden but then my footer got larger because of the code.
I copied the code from the code around the other input fields which fixed the footer width problem
but caused a big space at the place the hidden field is.
Please help.

Thanks,

L.
Max_admin 09 Sep, 2008
Hi Laure,

just make the field type hidden, remove any JS or CSS, hidden only is enough and the field is not visible and will not affect the layout!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
UHU 09 Sep, 2008

just make the field type hidden, remove any JS or CSS, hidden only is enough and the field is not visible and will not affect the layout!



I did but it messes up my footer width.

I don't understand.

Do you have any idea?

Thanks,

Laure
Max_admin 09 Sep, 2008
Hi Laure,

no idea, hidden fields are hidden, it should not make any issues, get Firefox with Firebug and check whats the problem!
Regards

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.