Jump to:

3429 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Adding Fields to Member Object

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

Page: 1
Go to End
Author Topic: 1249 Views
  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Adding Fields to Member Object Link to this post

    I'm having trouble adding fields to the Member Object

    Here is my PHP

    class ClientMember extends DataObjectDecorator {

    function extraDBFields() {
    return array(
    'db' => array(
    "ApprovedMember" => "Boolean",
             "CompanyName" => "Text",
             "TaxIDNumber" => "Text",
             "Distributor" => "Text",
             "SalesRep" => "Text",
             "SiteAccess" => "Enum('1', '2', '3', '4', '5')",
             "Description" => "Text"
    ),
    );
    }

    public function updateCMSFields(FieldSet &$fields) {
       $fields->push(new TextField('ApprovedMember', 'Verified Contact'));
       $fields->push(new TextField('CompanyName', 'Company Name'));
       $fields->push(new TextField('TaxIDNumber', 'Tax ID Number'));
       $fields->push(new TextField('Distributor', 'Distributor'));
       $fields->push(new TextField('SalesRep', 'Sales Rep'));
       $fields->push(new TextAreaField('Description', 'Description'));
       $fields->push(new TextAreaField('SiteAccess', 'Site Access Request'));
    }
    }

    Once I add the following line to my _config.php I get a blank page when visiting the site or rebuilding the db

    Object::add_extension('Member', 'ClientMember');

    Debug doesn't give me an more info.

    I want to eventually be able to check login against Approved Member (

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: Adding Fields to Member Object Link to this post

    Change

    Object::add_extension('Member', 'ClientMember');

    to

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

    Should do the trick ;)

  • zenmonkey
    Avatar
    Community Member
    527 Posts

    Re: Adding Fields to Member Object Link to this post

    I must have something else wrong because that didn't do. I think I've come up with a different way to handle it anyway

    1249 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.