17488 Posts in 4473 Topics by 1978 members
|Go to End|
7 June 2008 at 2:37am
I would like to know if it's possible to fill the Author field of the ArticlePage example (tutorial 2), automatically.
I was thinking about some way to identify the username that is adding the content (something like a $username variable), and fill the DB field with his/her username without typing it (without filling the author field with his/her name manually).
7 June 2008 at 8:18am
Yes, sure this is possible.
Just do something like this in the getCMSFields function:
$member = Member::currentUser();
$fields->addFieldToTab("Root.Content.Main", new TextField("Author", "Author", $member->FirstName . " " . $member->Surname));
9 June 2008 at 10:33pm
That's exactly what I needed.
|Go to Top|