Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Add field to "Edit User"

Go to End

3 Posts   1602 Views


Community Member, 197 Posts

18 August 2010 at 9:40am

I want to add a field to the "Edit User" area.

sapphire/security/member.php needs to be extended.

I created a file in the mysite folder but it does NOT work.

How can I add a field?


class UserCustom extends Member  {

	function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields->addFieldToTab('Root.Foobar', new LiteralField('CustomCodeFoobar','<h3>Foobar</h3>'));
		return $fields;





Community Member, 30 Posts

18 August 2010 at 11:50am


create a new File "MyMemberExtension.php" in the folder mysite

class MyMemberExtension extends DataObjectDecorator {

	 * Define extra database fields
	 * Return an map where the keys are db, has_one, etc, and the values are
	 * additional fields/relations to be defined
	function extraStatics() {
		$fields = array(
			'db' => array(
				'MyExtraDBField' => 'Text'
			'has_one' => array(
			'defaults' => array(
				'MyExtraDBField' => 'awesome default text'
		return $fields;

	function updateCMSFields(FieldSet &$fields) {
		$fields->addFieldToTab('Root.Foobar', new TextField("MyExtraDBField", "My Extra DB Field"));

and then add the following line to your "mysite/_config.php"

DataObject::add_extension('Member', 'MyMemberExtension ');

i hope that is what you are searching for, and i hope it works, i kinda copied it from the Forum Module but didn't tested it

greetings <°(((-<


Community Member, 197 Posts

18 August 2010 at 12:09pm

Works perfectly, thanks!