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.

All other Modules /

Discuss all other Modules here.

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

Newsletter Module: include subscription form


Reply


21 Posts   5811 Views

Avatar
Normann

Forum Moderator, 12 Posts

19 February 2010 at 10:18am

Thanks, yurigoul. Yup, the newletter module will be(or has already been?) decoupled from userdefinedform. We just didn't officially announced this due to the new features lack of testing. But that is what we think the right way to go.

By using the new "SubscriptionPage" you are be able to define a form with all fields available from Member, Member's subclasses, Member's decorators as the form field candidates, each field can be customised with its own label, its own validation message in CMS, etc.

The reasons to decouple the module from UserDefinedForm are, besides what yurigoul mentioned above, also because if an back-end user defined some fields that doesn't exist in Member (and its subclasses and decorators) in his UserDefinedForm, then he will lost in where these data goes and how to retrieve them.

In general, all modules for SilverStripe core should be only depended with SilverStripe core, and less related with other modules to keep them neat and work all the time. UserDefinedForm are dying, we just don't want the two modules coupled.

Avatar
Valorinbattle

Community Member, 95 Posts

19 February 2010 at 10:29am

Normann, is there a way to add the "Subscribe" field to other pages that aren't subscription page?
Also, I cannot get the unsubscribe feature to work. When I test it, it does let me submit the email address and select which newsletters to remove me from, but I don't get a confirmation page and it doesn't remove the record in the backend.

Thanks
~ James

Avatar
Normann

Forum Moderator, 12 Posts

19 February 2010 at 12:25pm

I guess the above discuss has already addressed about add the subscribe form to other pages, basically, it doesn't work well with the new version (2.4), but if you have to use the UserDefinedForm as your subscribe form, you might want to have some code in Page.php like:

function SubscribleBlurb(){
$subscribeForm = = DataObject::get_one('SubscribeForm');
if($subscribeForm && Translatable::is_enabled()){
$locale = Translatable::get_current_locale();
$subscribeForm = $subscribeForm->getTranslation($locale);
}
if($subscribeForm) {
$formController = new SubscribeForm_Controller($subscribeForm);
retrun $formController->Form()->fortemplate();
// or return $formController->Form()->renderWith('Form', 'your customise form template');
}
}

and in your Page.ss

$SubscribleBlurb

have your debug on, insert Debug::show(); to the above code since there might be syntax error there.

For your unsubscribe stuff, there a long story about this, and it's not working for a long time and need new release which works with 2.3/2.4, which is our effort in the near future. I suggest you go to Unsubscribe.php and find the function unsubscribe(), try to read the code and make your own fixes, debug::show() is still a good way to show what wrong there.

Good Luck.

Avatar
TF-35Lightning

Community Member, 137 Posts

29 September 2010 at 5:41pm

hi guys Im trying to extend the subsciption with a little bit of extra functionality. If anyone wants to help with a few simple steps that would be great.

http://www.silverstripe.org/all-other-modules/show/292918?showPost=292918#post292918&flush=1

Avatar
CHD

Community Member, 218 Posts

11 June 2011 at 4:01am

this may come in handy for anybody who wants to easily include forms in a sidebar or any other area of the site, without controlling a hidden page:

http://www.clickheredigital.co.uk/blog/how-to-include-a-silverstripe-form-on-any-every-page/