17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2003 Views |
-
Member Database fields

2 May 2007 at 7:14pm
Ive made this file BassdropMember.php
<?
class BassdropMember extends Member {
static $db = array(
"Birthday" => "Date",
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->Push(new DateField("Birthday", "Birthday"));
return $fields;
}
}
?>The cms field shows up in the admin form, but theres no field in the database for birthday. I have done a flush and Im sure it said building the date field.
The end result is I put a date in for the members birthday, and it doesnt save....
Have I got it all wrong?
-
Re: Member Database fields

2 May 2007 at 9:12pm Last edited: 2 May 2007 9:13pm
Normally we'd do it this way, rather than just a push of the new object...
function getCMSFields() {
return new FieldSet(
new DateField("Birthday", "Birthday")
);
}Try doing it this way - unsure if this will affect anything but it's worth a shot.
Cheers,
Sean -
Re: Member Database fields

2 May 2007 at 11:53pm
the security-admin doesn't auto-detect different members at the moment, please use this code in _config.php to globally switch to your custom implementation:
Object::useCustomClass('Member','BassdropMember');if that doesnt help: can you check that the table "BassdropMember" was properly created in your database, with a field "Birthday"?
-
Re: Member Database fields

4 May 2007 at 6:33pm
Yep, the table was created.
Cheers, I'm catching up with sam tomorrow, and will absorb his omnipotence
-
Re: Member Database fields

29 June 2007 at 1:04am
I've tried to add new fields in Member as described above, but stucked with the problem - newly created users belongs to class Member and so doesn't have new fields in user editing form.
I've resolved this problem by editing MemberTableField.php in cms/code.
(version 2.0.DailyBuild.2007-06-27 and 2.0.1)in function MemberTableField->addtogroup
replace
$className = $this->stat('data_class');
with
$className = Object::getCustomClass($this->stat('data_class'));May be this a bug?
test example:
mysite/code/SideMember.php
<?php
class SideMember extends Member {
static $db = array(
"PriceLevel" => "Int",
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->Push(
new NumericField("PriceLevel", "PriceLevel")
);
return $fields;
}
}
?>mysite/_config.php
<?
global $project;
$project = 'mysite';
include(dirname(__FILE__).'/_config_db.php');Object::useCustomClass('Member','SideMember');
?> -
Re: Member Database fields

29 June 2007 at 9:30am
this is indeed a bug, which is already fixed in some of our internal project-branches (still to be merged). we're approaching the whole thing a bit different now, "decorating" basic members with new stuff rather than subclassing.
until this functionality makes it into stable, your change should be sufficient. -
Re: Member Database fields

22 September 2007 at 9:14pm
Any hints/doku of your approach to this 'decorating'?
| 2003 Views | ||
|
Page:
1
|
Go to Top |





