Firefox PHP

Module: Group Auto-Email

Posted by Joe Curia 
All files from this thread

File Name File Size   Posted by Date  
group_autoemail_v5_2_1_07.zip 18.8 KB open | download Joe Curia 02/07/2010 Read message
forum12.gif 3.7 KB open | download harryatkins 01/17/2010 Read message
Forum-URL1.jpg 73.5 KB open | download harryatkins 01/25/2010 Read message
Forum-URL2.jpg 69.2 KB open | download harryatkins 01/25/2010 Read message
Forum-URL3.jpg 41.5 KB open | download harryatkins 01/25/2010 Read message
Module: Group Auto-Email
August 11, 2007 09:48AM
This module allows you to automatically subscribe groups to a forum when they are given rights to that forum. Any member of the group will receive a full copy of every post made in that forum. You can also give users the right to disable these emails on an individual basis. Other options include sending emails only for new topics, sending the signature with the email, not sending emails to selected groups, allowing users to choose not to receive copies of their own emails, and sending emails via a mail queue called by a cronjob. The mail queue option could speed up posting, particularly with a large number of reciepents. However, it could also delay the reception of emails from this module as cronjobs can only process a mail queue once per minute at the quickest.

As admin, if you want to receive emails from this module, you will have to be a part of the group which is receiving the email. Please note that the user page for users with Administrator access can be a bit deceiving. Even though the user has each group listed with "Group Moderator" status, the user is not technically part of the group until you hit update.

The email message can be customized via the language file. The default is:
From: System Email //set in the general settings
To: User Email
Subject: New message in the Sample forum at Sample Site.
Body: //full body shown between ~~~ lines which do not appear in actual email
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Author:
Subject:
Link: http://www.samplephorum.com/read.php?1,1,1#msg-1
First Post

Message:
Hi, This is my first post to this sample forum. I hope to become an active
member here.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Notes for Using the Cronjob Mail Queue Option
If you would like to use the Cronjob Mail Queue option you will need to complete two steps:

First, you must add a cronjob to call the Phorum "scheduled" hook from the Phorum script.php file. I would recommend that this cronjob run every minute. The module will handle any time-outs or errors which otherwise could cause the cronjob to run two instances of this module. This is one example cronjob:
* * * * * cd your/phorum/root && /usr/bin/php ./script.php --scheduled
There should be no output from this script unless there is an error. If possible I would also advise that you have the output from this script either logged or emailed.

Second, you must enable the Mail Queue option from this module's settings page.


As always, requests for added/improved features are welcome. Either post here or email (email included in readme).

This module can also be used in Phorum 5.1 but you need v1.01 which is found here.

Changelog:
v5.2.1.07
    - Enhancement: Added the option to send emails through a cronjob mail queue.  
      It will be necessary to read through the README before enabling this 
      option.
    - Enhancement: Added a debugging option to the settings page.
    - Enhancement: Support added for the Simple Rounded template.
v5.2.1.06
    - Enhancement: Added the option to only send emails of new topics, not 
      replies.  Thanks go to Phorum user Robert Angle for suggesting this 
      feature.
    - Enhancement:  Added the ability for the admin to choose groups which will 
      not receive emails through this module.  This allows for two groups to be 
      given access to a forum while only one group receives emails through this 
      module.  Thanks go to Phorum users Robert Angle and mila for pointing out 
      the need for this feature.
    - Bugfix: Added "Author: %author%" to the default email message.  I have 
      this in my own forum and was surprised to see that it was not in the 
      default language file for this module.  As always, the email message can 
      be edited by changing the language file.
    - Enhancement:  Added the option for admin to allow users to choose to stop 
      receiving group emails of their own posts.  Thanks go to Phorum user 
      snowcrash101 for suggesting this feature.
    - Enhancement: Created template files for the control center option along 
      with additional language fields for the template.  Thanks go to Phorum 
      user NeBuLuS for much of the code in this enhancement.
    - Enhancement: Added the option to include signatures in the post bodies.
v5.2.1.05
    - Enhancement: German language supported added courtesy of Phorum user
      Sunbringer.
    - Enhancement: Added support for the SMTP Mail module (both v0.8 and the
      newer versions using PHP Mailer).
    - Bugfix: If a message is posted in a forum with no groups attached, the
      message data was not passed on to the next module.
    - Enhancement: Moved the attachment processing out of the user loop to
      streamline the email process.
v5.2.1.04
    - Fixed a bug which could cause emails to fail.  Thank you itasor for
      helping catch and exterminate this bug.
    - Added debugging code which is disabled until debugging becomes 
      necessary.
v5.2.1.03
    - Added the option to send emails to users in a group which does not 
      have read permisions in the relevant forum.
    - Fixed a bug which could cause the emails to appear invalid.
    - Fixed a bug which caused a display error in the Control Center page.
    - Fixed a bug which caused problems for other tpl_cc_usersettings mods.
    - Cleared a number of php errors.
v5.2.1.02
    - Fixed a bug which would send emails to users if they were part of a
      group that was assigned to a forum, even if that group was not given
      permission to read the forum.  Now groups will need to have the read
      permission in order to receive messages from that forum.
    - Changed version naming convention to reflect Phorum compatibility.
v2.01
    - Added the ability to allow post attachments to be sent out with the
      email.
v2.00
    - Update for Phorum 5.2 compatability.
    - Updated the module to use the new "after_approve" hook.  This will
      ensure that an email is not sent out until after it has received
      moderator approval (if necessary).
    - Fixed bug which could try to retrieve a non-existant language file.
      Debug work and fix from jaybee (user at Phorum.org).
v1.01
    - Added the ability to allow users to individually stop the emails.
v1.00 
    - Started


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 9 time(s). Last edit at 02/07/2010 06:45PM by Joe Curia.
Attachments:
open | download - group_autoemail_v5_2_1_07.zip (18.8 KB)
Re: Module: Group Auto-Email
August 12, 2007 10:51PM
I have finished v2.01 with this change:
- Added the ability to allow post attachments to be sent out with the email.

The file at the top of this page contains the latest version.

Some questions for the phorum devs who know a bit more than me :)

This mod sends out an individual email to each user (to allow for users with different languages). Will this cause unnecessary delays in posting, especially if there is a large attachment? It seemed fine on my test server, but how will it affect posting with a large number of subscribers? Is there any way to have the email sent out separate of the linear posting functions?


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Group Auto-Email
August 12, 2007 11:51PM
There is no internal queueing system, so yes: posting time will be affected if there are a lot of messages to send and/or if the mailserver is responding slowly.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Group Auto-Email
August 15, 2007 03:50PM
PHP sends all email synchronously. There is no way to do it from within PHP. We have always recommended using mailing list software for such a function.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Module: Group Auto-Email
August 15, 2007 03:53PM
or some nifty queuing system which sends mail through a cronjob/daemon-process.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: Group Auto-Email
August 15, 2007 05:10PM
before I spend too much time worrying about this, would either the mailing list or queuing system be theoretically possible from inside a mod? Or would they require something installed on the server itself?


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 1 time(s). Last edit at 08/15/2007 05:11PM by Azumandias.
Re: Module: Group Auto-Email
August 15, 2007 05:16PM
A maillist is simply an external application which has one mail-address where you send your message to, so no, that wouldn't be directly possible inside a module.

The queueing system is possible in a module but requires the possibility to run a cronjob or another daemon-process.
I played once upon a time with the Mail::Queue Package from pear -> [www.phorum.org] there I implemented it as hack of email_functions.php but its possible with a mod too.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Module: Group Auto-Email++
October 06, 2007 09:26PM
I slightly updated that mod:
1) change hardcoded html to template
2) change hardcoded labels to language

EDIT: Thank you for your code work. I have incorporated it into the module. Thanks again - Joe Curia.



Edited 1 time(s). Last edit at 11/12/2009 07:05AM by Joe Curia.
Re: Module: Group Auto-Email
October 20, 2007 02:52PM
Looking at the code, I see this:
function phorum_mod_group_autoemail_after_approve($data) {
	if (PHORUM_APPROVE_MESSAGE || PHORUM_APPROVE_MESSAGE_TREE) {
		$data[0]["status"] = 2;
		phorum_mod_group_autoemail_after_post($data[0]);
	}
	return $data;
}

That red statement will always evaluate as TRUE, since those are two constants.

Edit: I think you might want to use the following code:

phorum_mod_group_autoemail_after_post($data) {
    // Only send mail if the message is approved.
    if ($data['status'] != PHORUM_STATUS_APPROVED) return $data;
    ... counting code ...
}

and

phorum_mod_group_autoemail_after_approve($data) {
    list ($message, $approve_type) = $data;

    // Only send mail if the message was in holding state
    // (hold = new moderated message, not yet approved)
    if ($message['status'] != PHORUM_STATUS_HOLD) return $data;
    ... counting code ...
}

Edit: There some more going on here. In case $approve_type is set to the PHORUM_APPROVE_MESSAGE_TREE constant, then there could possibly be more message to mail out in the message tree.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 2 time(s). Last edit at 10/21/2007 01:39AM by mmakaay.
Re: Module: Group Auto-Email
November 28, 2007 03:19PM
Quote

I have finished v2.01 with this change:
- Added the ability to allow post attachments to be sent out with the email.
The file at the top of this page contains the latest version.

That´s exactly what I was looking for. But unfortunately I can´t find the v2.01 to download? It´s not in the posted version at the top of the page as far as I see.
I would be glad if s.o. could repost it.

Thanks for your help



Edited 1 time(s). Last edit at 11/28/2007 04:09PM by bombur2000.
Sorry, only registered users may post in this forum.

Click here to login