10389 Posts in 2200 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 472 Views |
-
Member Profiles - Add subheadings between fields

19 November 2011 at 12:23pm
I'm using the member profile module to make a login area to my website.
The registration process now has many fields, which needs splitting up into sub headings.
How do you go about inserting sub headings at certain points in the profile form?
Can anyone help?
-
Re: Member Profiles - Add subheadings between fields

20 November 2011 at 1:51am
you can use LiteralField
New LiteralField('HeadingAdressSection', '<h3>Please give us your adress</h3>')
-
Re: Member Profiles - Add subheadings between fields

20 November 2011 at 1:24pm Last edited: 20 November 2011 1:25pm
Thanks for taking the time out to reply.
I'm familiar with literal field. However, are you aware of the member profiles module and how it works? If only it were that easy...
Here's where I am so far. I have installed the member profiles module, created a MemberDecorator as a Dataobject decorator.
In the decorator, I have added some custom stats like so:
function extraStatics() {
return array (
'db' => array(
'Role' => 'Varchar(255)',
'Organization' => 'Varchar(255)',
'Secondary Email' => 'Varchar(255)',
'PhoneNumber' => 'Varchar(255)',
'HomePhone' => 'Varchar(255)',
'FaxNumber' => 'Varchar(255)',
'Mobile' => 'Varchar(255)',
'PreferredContactMethod' => "Enum('Email,Fax,txt','Email')",
'PreferredEmergencyContactMethod' => "Enum('Email,Fax,txt','Email')",
'WorkAddress' => 'Varchar(255)',
'City' => 'Varchar(255)',
'PostalCode' => 'Varchar(255)',
'Status' => "Enum('txt','txt')",
'HeadingAdressSection' => 'Varchar(255)'
),
'defaults' => array(
'Status' => 'Disabled'
)
//,'has_many' => array( 'Subscription' => 'Subscription' )
);
}If you see, the last database entry is "HeadingAddressSection" so what I need to do is have member profiles recognise this as a literal field, so I have set the following:
public function updateMemberFormFields(&$fields) {
$fields->removeByName('HeadingAdressSection');
$fields->push( new LiteralField('HeadingAdressSection', '<h3>Please give us your adress</h3>'));
}Attempting to remove the field which member profile creates, and adding my new literal field.
This, however doesn't work. It stops that field from being added to the member profile list of fields entirely.
Does this make sense now?
If anyone can provide help, I'd really appreciate it.
-
Re: Member Profiles - Add subheadings between fields

27 November 2011 at 7:28am
I've ended up adding LiteralFields into the MemberProfilePage.php decorator under "getProfileFields".
$fields->insertBefore(new LiteralField (
'MemberHeader', '<h2>Heading</h2><p>blah blah blah.</p>')
, 'Role');Not ideal, as this depends on the field "Role" being active on the registration form. But at least it gets the content into the form at the appropriate spot.
Still happy to hear more appropriate alternatives?
-
Re: Member Profiles - Add subheadings between fields

24 January 2012 at 3:13am Last edited: 24 January 2012 3:13am
do this:
<?php
class MemberProfilePage_ControllerDecorator extends DataObjectDecorator {
public function updateProfileFields(&$fields) {
$fields->insertBefore(new LiteralField('Hd_Personal', '<h3>Personal data<h3>'), 'FirstName');
}
}and to config add
Object::add_extension('MemberProfilePage_Controller', 'MemberProfilePage_ControllerDecorator');
all credits for Zauberfisch
| 472 Views | ||
|
Page:
1
|
Go to Top |


