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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Changes member's field in Security tab ( Decorator object )


Go to End


1590 Views

Avatar
lamchau12

Community Member, 4 Posts

28 April 2010 at 8:55pm

Hi all,

I'm using decorator object to add one extra field ( AvatarURL field ) to member table.
In the Security tab, we have four fields : FirstName, Surname, Email, Password.
When clicking on "Add" button, we will see some fields. In those fields, there is my extra field ( AvatarURL field).

I want to display my extra field ( AvatarURL field ) with four fields. That means on the table, i will have FirstName, Surname, Email, Password, AvatarURL. HOW COULD I DO THAT ?

Below is my code of decorator class :

<?php
class Deelnemers extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
'AvatarURL' => 'Varchar',
),
'has_one' => array(
'RelatedMember' => 'Member',
),
);
}

function updateCMSFields(FieldSet $fields){
$fields->push(new TextField('AvatarURL','Enter AvatarURL'));
}
}

class Deelnemers_Controller extends Page_Controller{

}

?>