Forums

Get Registered User Name from Form PHP Code?

joomlanoob 09 Apr, 2009
Is the users logged in name available to PHP code in a Chronoforms code block? I would like to know the user name so I can make some runtime changes to the form before they see it.

Thanks in advance for any info.
GreyHead 09 Apr, 2009
Hi joomlanoob,

[forumsb]getUser[/forumsb] - plenty of examples here.

Bob
joomlanoob 09 Apr, 2009
Thanks! That snippet looks like exactly what I need.

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

?>

I'll give it a try in the morning. Also looks like JFactory may be a class I should take a look at.
GreyHead 09 Apr, 2009
Hi Joomlanoob,

Yes that it (should be =& JFactory. . .) to save a bit of memory. JFactory is Joomla's Object creation class - gives you access to many of the standard Objects , User, DBO, Document, etc,

Bob
joomlanoob 10 Apr, 2009
Thanks Bob!

It worked great. Started exploring JFactory and found a way to get the page title from JFactory (getDocumet ... getTitle). 🙂

Again, thanks for the tip!
This topic is locked and no more replies can be posted.