Forums

How to get the userid into the mail template

pako69 05 Jul, 2011
(sorry for my english, i'm french)
My customer wants to use the Joomla userid as a client number
What php code and where ?
Thank you very much
GreyHead 05 Jul, 2011
Hi pako69,

You can get the current User ID using
<?php
$user = JFactory::getUser();
?>

Then the user id is available as $user->id

Bob

I would avoid using the Joomla! ID as a client number - it has some securit risks unless you are very careful.
pako69 05 Jul, 2011
Thank you,

I allready know this php code, but i do not know where i must insert it ?
Remember i want the user id to be sent in the form...

Thanks
pako69 05 Jul, 2011
Sorry to insist but my customer want it tomorrow... 😟
Thank you
GreyHead 05 Jul, 2011
Hi pako69,

Please take the time to work out the question you want answered before you post.

If you want the user id in the email template then use <?php echo $user->id ?> plus the code you already know.

Bob
pako69 05 Jul, 2011
Excuse me but i'm french and it's very hard to find any answers solutions in the forum.
Anyway, i'm happy you can help, me, just tell me exactly where i mus write this code ?
Thank you again.
GreyHead 05 Jul, 2011
Hi pako69,

Etre français n'est pas une bonne excuse pour ne pas penser . . .

S'il vous plaît lisez mon dernier post.

Bob
pako69 05 Jul, 2011
Désolé je n'ai pas le temps ce soir d'avoir de l'humour.
J'ai lu vos posts et vous me dite de mettre ceci :

<?php
$user = JFactory::getUser();
echo $user->id
?>


Oui, mais où ???

I have 50 articles to be ready for tomorrow morning and i lossing my time with programation
Please help me, i can give you access to my backend you want ?
GreyHead 05 Jul, 2011
Hi pako69,

There's no humour there - you're wasting your time and mine.

The code can go directly in the Email template. If you are using ChronoForms v3 then you need to set 'Use template Editor' to No in the Email Setup Properties box first.

Bob
pako69 05 Jul, 2011

you're wasting your time and mine.

>
Sorry for that.

"Use Template Editor: no"

Yes it works, thank you

I didn't saw any documentation about that, isn'it ?
This topic is locked and no more replies can be posted.