Firefox PHP

Daily/Weekly/Monthly Digest

Posted by madt 
Daily/Weekly/Monthly Digest
June 12, 2006 07:39AM
Hi,

I was wondering whether I am right to think that a Digest functionality would need to be added as a hack?

Here is what a Digest would entail:

constants.php

Add PHORUM_SUBSCRIPTION_DIGEST_DAILY, ..._WEEKLY, and ..._MONTHLY constants and set its numeric values.
[--- I see there is already a PHORUM_SUBSCRIPTION_DIGEST constant defined, but this is not used anywhere in Phorum. Is a Digest functionality in the pipeline? ---]

follow.tpl

Replace the current send_email checkbox with a dropdown select menu containing the existing options, Bookmark and E-mail, as well as 3 new options: Daily Digest, Weekly Digest and Monthly Digest

follow.php

Check whether form has been submitted, and instead of setting the type with the ternary operator (to choose between Bookmark and E-mail depending on if the send_email checkbox was checked), rather set type to the value of send_email.


The sending of the actual Digest e-mails can be incorporated as a scheduled module.
In the database, a timestamp field will need to be added to the _subscribers table. Each time a digest is sent for a subscription, this field will need to be updated to the timestamp on which the digest was sent. This will allow the scheduled module to know the date from which topic posts should be included in the e-mail, to prevent a digest email from containing all posts from a specific forum topic. Otherwise a fixed valuse can be provided (for example '15') and the scheduled module will only email the latest x posts from a topic (in this case 15).

Thus, this type of Digest functionality works in the same way as the 'Follow this topic via e-mail' option currently available in Phorum. Each digest only contains posts from one topic.

I suppose a Digest functionality where one Digest will contain posts from various topics can also be implemented, but this is not what I am interested in at the moment.

Any comments/ideas will be appreaciated.
madt
Re: Daily/Weekly/Monthly Digest
June 12, 2006 07:53AM
Quote
madt
I was wondering whether I am right to think that a Digest functionality would need to be added as a hack?

IMO it can be done as a module already. There are plenty of hooks in the mail-sending and posting-process already.

Quote
madt
[--- I see there is already a PHORUM_SUBSCRIPTION_DIGEST constant defined, but this is not used anywhere in Phorum. Is a Digest functionality in the pipeline? ---]


no, as this would need a cron-job or other scheduled parts to be run which can't be done in the common install.

Quote
madt
I suppose a Digest functionality where one Digest will contain posts from various topics can also be implemented, but this is not what I am interested in at the moment.

I don't think it makes much sense without combining the digests from various topics in the same message. Usually digest are implemented to get less messages and combining the digests from multiple topics would help for that too.


Thomas Seifert



Edited 1 time(s). Last edit at 06/12/2006 11:16AM by ts77.
Re: Daily/Weekly/Monthly Digest
June 12, 2006 10:15AM
Hi,
thanks for the reply.

I agree that a combined digest is better than single digests for every thread subsribed to, but even if a combined digest is implemented, a user will still need to subscribe to certain topics by clicking on the 'Follow...'/'Subscribe'/'whatever you may call it' link to activate the subscription. Then, if a user has more than one weekly digest subscription, the different topics can be combined into one weekly email.

How can different subscription options be implemented without modifying the follow.tpl template as well as the php code that processes the subscriptions (in follow.php)? If the Digest functionality is split up into its own module, then a seperate link will be needed to subscribe to Digests, and users will have to manage their digests and subscriptions seperately, which is not very user-friendly. Or am I not understanding correctly what you mean with:
"IMO it can be done as a module already. ..." ?

I apologize if this is the case, I will look at other module examples some more and see if I can figure out how to do this via a module. Any ideas? i seem to be on the wrong path...

The scheduled module for sending the digests will of course need to be run via cron-job, and if you do not have access to set this up, the digests cannot be sent automatically.

Regards,
madt
Re: Daily/Weekly/Monthly Digest
June 12, 2006 11:04AM
thinking of that further, you could create your own custom profile field which stores a setting like "daily/weekly/immediate" mails and subscribing is done as usual.
When a new message is sent you could catch the outgoing mail and check for each user if he has set his settings to be digest. if its a digest store it into a separate table for later processing in a cronjob.
I wouldn't define for *every* subscription how its handled, I'd make it a setting for the whole user.

just an idea, nothing else.

I think a hack would be interesting too if it doesn't involve a performance penalty.


Thomas Seifert
Re: Daily/Weekly/Monthly Digest
October 11, 2006 09:24AM
has anyone had a look at this mod/hack? It would be great to give registered users the option of receiving a weekly email digest of latest/popular phorum posts.
Re: Daily/Weekly/Monthly Digest
October 12, 2006 05:28AM
That's a very good idea, Thomas. But unfortunately the forum I set up required users to be able to select the type of subscription per topic. I implemented it as a hack at the end, along with daily/weekly/monthly cronjobs, as I had limited time.

MarkFresh, I can send you the details about the hack if you are interested. Maybe you can find a way to do it better. The way I did it would mean that every time you upgrade to a newer version of Phorum, you would have to manually implement the changes again. Hence the word 'hack'!

I don't think there is a performance issue, as the phorum runs as normal, except for a few extra options when you subscribe to a topic or edit your subscriptions. The digests get sent with seperate external 'modules' that run at night.

I'm sure there would be a more optimal way to do it though....
madt
Re: Daily/Weekly/Monthly Digest
October 12, 2006 05:42AM
could you post your hack or send it by mail?
maybe I could do something to get it implemented in the core :).


Thomas Seifert
Re: Daily/Weekly/Monthly Digest
July 30, 2007 10:29AM
Has anyone made progress with this module/hack?

My client has enquired about it - we currently use the Group Auto Email, which send an email to members on every post, but some users may be interested in just a regular digest of messages.

Best regards,

David



Edited 1 time(s). Last edit at 07/30/2007 10:29AM by dkdo.
Re: Daily/Weekly/Monthly Digest
July 31, 2007 06:27PM
You really should look into a mailing list server that would handle all these things. Doing this in PHP is not fast and not a good use of PHP.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Sorry, only registered users may post in this forum.

Click here to login