Registered Username in Form Field (Text) Predefined

Permalink
Hi,

is there a way to modify C5 Form Block in order to display a textfield with the username as default. The users are all registered!

I want this because entries should be marked with the username and saved on the database besides the other informations.

Please help me with any idea or hints.

Thanks in adavanced.
Omar

primewaydesign
 
DAkers replied on at Permalink Reply
Not sure where you are getting the user value from. But what you could do is create a custom template for the form block and have this input text field predefined in the template view file.

Do you know how to do custom templates?
primewaydesign replied on at Permalink Reply
primewaydesign
Yes I know a bit how to use custom templates, but I don't know how to make one textfield default text the users name.
DAkers replied on at Permalink Reply
When you build the custom template, you could grab the current user from this variable:

$uName = $u->uName;


And then just put that php variable into the value property of the text input:

<input name="username" type="text" value="<?php echo $uName; ?>" />