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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

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

newsletter signup form

Go to End



Community Member, 135 Posts

1 September 2008 at 3:12pm

Edited: 01/09/2008 6:46pm

*update4* SOLVED
in SugnupForm.php, changed

	$groups = $member->Groups();
		$groups->setByCheckboxes(array("newslettersubscribe"), $data);


if($group = DataObject::get_one('Group', "Code = 'newslettersubscribe'")) {

I need some way to get Member id and add it to the Gourp_Member table when people register for the newsletter.

*update 2*
When I add a member manually from the newsletter tab in the admin panel, the row is added to the member table, in the same format...

I figured out that it is writing to the "Member" table in the database. Is there a way for the news letter to automatically add members from the Member list?


I followed the guide here:

(I see the note saying its outdated.)

What could be done to make this work? The only problem I have is that it isn't adding anything to the database.

here is what I have:


class SignupForm extends Form {	
	function signup($data,$form) {
		// Create a new member using the data from the form
		// TODO: needs validation - all fields filled out, email doesn't exist already etc
		$member = new Member($data);
		// Add the new member to the 'newslettersubscribe' group
		$groups = $member->Groups();
		$groups->setByCheckboxes(array("newslettersubscribe"), $data);
		// Write the Member table row


class SignupPage extends Page {
class SignupPage_Controller extends Page_Controller {
	function AfterContent() {
		// This is a dirty hack, suggestions?
		// It returns early if we're on the thanks page - we don't want the form on that page
		if($this->urlParams[Action] == 'thanks') return;
		return new SignupForm($this, "AfterContent", 
			new FieldSet(
				new TextField("FirstName", "First Name:"),
				new TextField("Surname", "Surname:"),
				new TextField("Email", "Email:")
			new FieldSet(
				new FormAction("signup", "Subscribe")
			new RequiredFields(

I have a newsletter named newslettersubscribe. I made it from the newsletter tab of the admin panel.

I know there is a "subscribe form" page type, but I don't want the users to need to use a checkbox for selecting the news group.

Is there a way to set a "default" news group maybe?