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:

All other Modules /

Discuss all other Modules here.

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

Newsletter Module subscription page/process adding users and extending basic functionality a little, need help

Go to End



Community Member, 137 Posts

29 September 2010 at 4:59pm

Edited: 29/09/2010 5:02pm

Hi guys,
I am trying to do a few things to the Newsletter Module sign up process and as this module isnt kept up to date before and I don't have that much knowledge of Silverstripe I have found this very difficult, and have gone off what is being discussed in these threads:

All I want to do is.
1. When user enter email address into subscription form their email is added to members table and appropriate group for mailing list (which is currently working)

2. At the same time I want 2 new fields for this record, 1: to hold a randomly generated number 2: to have another field hold what the status is for this user (eg at the moment they in the table but they are unconfirmed because they havent clicked a link in the email I am about to send them )

3. Send the user an email with a confirmation link that holds a link to the page where this checking will be done and obviously it needs to be something like mysite/mailinglist?email=theuser@theiraddress&randomnumber=3geg23r3wrf23f

4. I then check to make sure the records email and randomnumber is the same before replacing my (unconfirmed, with confirmed)

Here is what I have for step 1 which works, but as I mentioned I am a bit at a loss at how to do these other few steps and are hoping someone out there might be able to help me through it. Any help would be great

Step 1: (user is added to membertable and appropriate group)


class SignupPage extends Page {
static $db = array(
static $has_one = array(

class SignupPage_Controller extends Page_Controller {

// Make sure you set this to the right group. See
private $defaultGroupID = 3;

//This function lets you put a form on your page, using $Form.
function SignUpForm() {
$fields = new FieldSet(

// List your fields here
new TextField("FirstName", "First name"),
new TextField("Surname"),
new EmailField("Email", "address"),

$actions = new FieldSet(
new FormAction("SignupAction", "Sign up")

$validator = new RequiredFields(
"FirstName", "Surnname", "Email"
// List the required fields here: "Email", "FirstName"

$form = new Form($this, "SignUpForm", $fields, $actions, $validator);
return $form;

// This function is called when the user submits the form.
function SignupAction($data, $form) {

// Create a new Member object and load the form data into it
$member = new Member();

// Write it to the database. This needs to happen before we add it to a group

// Add the member to group. (Check if it exists first)
if($group = DataObject::get_one('Group', "ID = $this->defaultGroupID")) {

// Redirect to a page in this case the home page


// Redirect to a failure page
/* Director::redirect('failure/'); */