Customised Subscription

Vote:
 

Hello all,

Can anyone point me towards some EPiServer subscription functionality documentation from a developers point of view as there is very lttle material out there. There seems to be high-level material only on the EPiServer website.

I have consulted the SDK but without examples its difficult pin down what I can make use of.

I have a scenario where we need subscription to work with properties on pages. So each page (in edit mode) can have properties set like "Region", "Work sector",..etc. A user can register to be notifed about a work sector in a specific region. The EPISubscribe property isnt really enough for this.

So if I register to be notified about agriculture in the north west of england, any changes to those pages that match this, based on what is set in edit mode, should be picked up/flagged for me (the subscriber).

Any help would be greatly appreciated.

#41702
Jul 21, 2010 16:50
Vote:
 

I would love to see EPiServer document things like this better in the SDK/Developer's guide, but it seems Reflector will still be an important tool for years to come ;)

What you want to do is to create a custom subscription class that inherits from the EPiServer.Personalization.SubscriptionMail class. Then you need to override the "Send" method (you should really use Reflector to get an idea of what it looks like).

In the send method, can then filter the ChangedPages-collection (that is received as an argument to the method) on whatever properties you want (ie. Region, Sector).
I recommend you store information about what Region/Sector a user is associated with or wants to subscribe to in the user's EPiServerProfile, because the UserData-property of your inherited class will contain the user's profile.

Then you configure EPiServer to use your class for subscriptions (can be done both from admin mode and in the site-element in web.config if I recall correctly) and you're done.

Hope this will help you on your way, but please ask if you want me to elaborate on anything :)

 

 

#41703
Edited, Jul 21, 2010 17:29
Vote:
 

Thats fantastic. Thank you for the prompt reply and advice Jørgen. I'll give this a shot.

#41704
Jul 21, 2010 17:35
Vote:
 

Hi Jørgen.

I am having trouble saving information about the region/sector to the users EPiServerProfile. I noticed there is a 'PropertyValues' property on the EPiServerProfile object but I am unable to create properties to add to it. Any pointers on how to do this?

Thank you

#41715
Jul 22, 2010 15:20
Vote:
 

If you are using the standard setup with the aspnet profile provider, you need to configure any properties you want to save to the profile. Look at the profile section in web.config.

#41716
Jul 22, 2010 15:45
Vote:
 

Hi Magnus, that worked great, thank you

#41719
Jul 22, 2010 15:54
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.