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

Registering users and custom fields


Go to End


1101 Views

Avatar
steve-jsc

Community Member, 1 Post

2 October 2012 at 1:18pm

I'll start with a description of the problem and what I've done so far. Any input is greatly appreciated.

The basic outline of the problem is that we're publishing a white paper to our SS site, but we want users to register to view the content. We'd also like a checkbox on the registration form to allow visitors to sign up to our MailChimp email list. Users will also need to be able to edit their details, including opting out of the mailing list.

So far I have added Andrew Short's member profiles (https://github.com/ajshort/silverstripe-memberprofiles) module to the CMS. I've created a new group in the CMS where everyone that registers will appear. On the white paper page, I hide the content unless the logged in user is a member of the new group. If nobody is logged in, I show a link to register and a login form (using the default form via $LoginForm).

This works for something basic to get people registering to view content, but we need more, and this is where I run in to trouble. I need to add a field to the Member object that lets us know they want the newsletter. I can extend the Member object, but this isn't best practice, as it will affect every Member object, when I only want to affect the registered users. I've read about using a member role extension, but I'm not sure if this gives us what we need. This approach may need a custom register form written as the member profiles module takes its fields from the Member object.

What other approaches to solve this problem are out there?

This is on SS 2.4.7.