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.

Data Model Questions /

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

Adding Fields to Member Object


Go to End
Reply


3 Posts   1486 Views

Avatar
zenmonkey

Community Member, 541 Posts

25 August 2009 at 12:45am

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 (

Avatar
Hamish

Community Member, 712 Posts

26 August 2009 at 9:58am

Change

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

to

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

Should do the trick ;)

Avatar
zenmonkey

Community Member, 541 Posts

27 August 2009 at 8:44am

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