In our discussions about comment subscriptions, site subscriptions, etc., I think it would be beneficial to create a core module for subscriptions. This could provide the model, interceptors, views, etc. for ContentBox.
Allow for management of subscribers
Allow for subscribers to subscribe to comments of individual content
Allow subscribers to subscribe to content types (new pages, new blog entries, etc)
Allow subscribers to manage their subscriptions
Allow subscribers to unsubscribe from individual subscriptions, multiple, or all
Subscriber - Core subscriber object
BaseSubscription - Abstract object for all subscriptions
CommentSubscription - Subscription subclass for content comments
relatedContent (many-to-one, content to which subscription is tied)
ContentSubscription - Subscription subclass for content types
frequency (frequency of updates--0=immediate,1=daily,2=weekly,3=monthly)
In all subscription emails, a link could be provided (using subscriber token) that allows the subscriber to manage their current subscriptions. The view could show a list of all current subscriptions, by type (e.g., comment and content for now). Each would have a checkbox which, when unchecked, would remove the subscription from the subscriber.
In all subscription emails, a link could be provided (using subscription token) that allows the subscriber to remove the individual subscription. The view would show a confirmation (Yes/No) and submit via AJAX on confirmation to remove the subscription.
The view could also provide a link for the subscriber to view all their subscriptions and manage them.
Adding subscribers could happen a few ways.
Via comments: The comments form will display a new checkbox allowing the user to:
Subscribe to comments added to content
Subscribe to site updates
When either of these is checked, the email address will be checked against the Subscriber repo. If they do not exist, they will be added as a subscriber, and their subscriber will be used when creating whatever subscriptions they checked.
Via Widget: A widget can be added as a part of this module which allows for a simple form to be placed on a page (sidebar, for example). This widget will let the user enter their email address to sign up to receive updates from the site (based on frequency preference)
An interceptor for cbui_onCommentPost and cbadmin_onCommentStatusUpdate should be added to send notification emails to subscribers when
new, non-moderated comments are added via the comment form or
when moderated comments are approved via the Admin.
Optionally, only subscribers who are not the commenter should receive the email notification.
For subscribers that have "immediate" content subscriptions.
An interceptor for should be created to handle the following announcements:
For each event, the ContentSubscription repo should be checked. If the content is published AND the subscriber has an "immediate" subscription to the contentType of the content, an email notification will be sent.
Scheduled Tasks for Interval Updates
For content subscribers who have a frequency other than "immediate", a scheduled task should fire at pre-defined intervals (daily, weekly, monthly). The method executed by these tasks should check ContentSubscription for subscriptions that match the defined interval and send an email for all published content that:
has been added since the last interval (yesterday, last week, last month)
matches the contentType for which the subscriber has a subscription (blog, page, etc)