Hi,
i want to show the username of the currently logged in user on the form.
I tried the following:
Drag and Drop a Custom Element in the Wizard
On the "Code" Property I inserted:
But on the Frontpage View, I only get "Your username is ", the username doesn't show up ๐ข
Any suggestions on how to show the username?
Thanks!
i want to show the username of the currently logged in user on the form.
I tried the following:
Drag and Drop a Custom Element in the Wizard
On the "Code" Property I inserted:
<?php
$user =& JFactory::getUser();
echo "<p>Your username is {$user->username}</p>";
?>
But on the Frontpage View, I only get "Your username is ", the username doesn't show up ๐ข
Any suggestions on how to show the username?
Thanks!
Hi supertux,
The code looks correct to me - it will only display the username if you are logged in though.
Bob
The code looks correct to me - it will only display the username if you are logged in though.
Bob
I'm unbelievable stupid, I was logged in at the backend, but not in the frontend, so it's no wonder it didn't show the username. ๐
Thank you anyways!
Thank you anyways!
There's still one problem:
I create a textbox, as default value i chose "<? echo "welcome ". $user->username; ?>"
Then I click Apply, Close, and Save the form.
When I go to preview, all works fine.
But then, when I click "Wizard Edit" again, the textbox gets totally messed.

If I click Save and then go to Preview, I get an Error message.
๐คจ
I create a textbox, as default value i chose "<? echo "welcome ". $user->username; ?>"
Then I click Apply, Close, and Save the form.
When I go to preview, all works fine.
But then, when I click "Wizard Edit" again, the textbox gets totally messed.

If I click Save and then go to Preview, I get an Error message.
๐คจ
Hi supertux,
I don't think that you can put PHP into a default value box. I believe that you can only use text strings there.
Bob
I don't think that you can put PHP into a default value box. I believe that you can only use text strings there.
Bob
This topic is locked and no more replies can be posted.