Firefox PHP
Re: Group Auto-Email Module
May 24, 2007 08:31PM
Bug fix in v1.01 in group_autoemail.php , change line 111 to
} elseif (file_exists("./mods/group_autoemail/lang/{$PHORUM['language']}.php"))

This ensures that users whose default language isn't English aren't getting an error.
Re: Group Auto-Email Module
June 11, 2007 11:37PM
Actually after looking again, I realised what I wanted to do, and the %FORUM% tag is not what I want to change. What I want to change is where the reply to would be.

Default is a general setting in the settings in admin of phorum, however This is want I trying to.

From Address Line::
FORUM NAME <furomname at domain dot tld> on behalf of Full Name <name at email dot tld>
the <> Would where the reply goes to, if someone hit the REPLY ALL. Reply would just got right back to the forum. I don't even know where to begin on this one. And becuase of Time, I am limited to what I can do. I know something
%forumname% <forum_name@domain.tld> on behalf of JIm Bob <jim@bob.tld>

I saw the hook, but don't understand the VAR assignments.
[MOD REQUEST I'll POST THERE]



Edited 2 time(s). Last edit at 06/12/2007 03:44AM by scottd@ucann2.org.
Re: Group Auto-Email Module
June 12, 2007 03:07AM
An SQL-error occured in your phorum-installation.

The error-message was:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: select DISTINCT(email),user_language from phorum_users where user_id in ()

I just upgrade to 5.1.22, And trying to use the group_autoemail, and this is what I get.

I removed the old group_autoemail, and replaced it, now it works.



Edited 1 time(s). Last edit at 06/12/2007 03:27AM by scottd@ucann2.org.
Re: Group Auto-Email Module
July 10, 2007 03:46PM
Per-Group Permission for Group Email Diff

This diff adds per-group permissions for the group emailer and overrides the "if a group has any permission then it gets a group email" to "if a group has group email permission set then it will get the group email". Everything else is the same.

To use it, set the permission to the group to have group email permission. All members of the group will get an email if this permission is set.

This lets you (as in my case) to have a group of admins that get copied on every email but a select subset of users on the site to get normal operation.

Index: mods/group_autoemail/group_autoemail.php
===================================================================
--- mods/group_autoemail/group_autoemail.php (revision 1685)
+++ mods/group_autoemail/group_autoemail.php (revision 1684)
@@ -16,7 +16,7 @@

// Get the list of all groups with permissions for this forum.
$group_ids = array();
- $sql = "select group_id from {$PHORUM['forum_group_xref_table']} where ( permission & 512 > 0 ) and forum_id = ".$data["forum_id"];
+ $sql = "select group_id from {$PHORUM['forum_group_xref_table']} where forum_id = ".$data["forum_id"];

$res = mysql_query($sql, $conn);
if ($err = mysql_error()) phorum_db_mysql_error("$err: $sql");
@@ -49,6 +49,7 @@
$user_ids[$row["user_id"]] = $row["user_id"];
}
}
+
if (!$user_ids) return;

// Get the emails and languages of the users selected above.
Index: include/admin/groups.php
===================================================================
--- include/admin/groups.php (revision 1685)
+++ include/admin/groups.php (revision 1684)
@@ -179,8 +179,7 @@
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_EDIT."]", 1, "Edit&nbsp;Their&nbsp;Posts")."<br />".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files")."<br />".
$frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages")."&nbsp;&nbsp;".
- $frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users")."&nbsp;&nbsp;".
- $frm->checkbox("new_permissions[".PHORUM_USER_GROUP_EMAIL."]", 1, "Group Email")."&nbsp;&nbsp;";
+ $frm->checkbox("new_permissions[".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users")."&nbsp;&nbsp;";


$arr[]="Add A Forum...";
@@ -203,7 +202,6 @@
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_ATTACH."]", 1, "Attach&nbsp;Files", $perms & PHORUM_USER_ALLOW_ATTACH)."<br />".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_MESSAGES."]", 1, "Moderate Messages", $perms & PHORUM_USER_ALLOW_MODERATE_MESSAGES)."&nbsp;&nbsp;".
$frm->checkbox("permissions[$forum_id][".PHORUM_USER_ALLOW_MODERATE_USERS."]", 1, "Moderate Users", $perms & PHORUM_USER_ALLOW_MODERATE_USERS)."&nbsp;&nbsp;".
- $frm->checkbox("permissions[$forum_id][".PHORUM_USER_GROUP_EMAIL."]", 1, "Group Email", $perms & PHORUM_USER_GROUP_EMAIL)."&nbsp;&nbsp;".

$frm->hidden("forums[$forum_id]", $forum_id);

Index: include/constants.php
===================================================================
--- include/constants.php (revision 1685)
+++ include/constants.php (revision 1684)
@@ -109,7 +109,6 @@
define("PHORUM_USER_ALLOW_MODERATE_MESSAGES", 64);
define("PHORUM_USER_ALLOW_MODERATE_USERS", 128);
define("PHORUM_USER_ALLOW_FORUM_PROPERTIES", 256);
- define("PHORUM_USER_GROUP_EMAIL", 512);

define("PHORUM_MODERATE_ALLOWED_ANYWHERE", -1);
Attachments:
open | download - group_email_permission.diff.gz (444 bytes)
Re: Group Auto-Email Module
July 24, 2007 10:42AM
I'm a bit of a newbie so please forgive me if this has been answered elsewhere!

I have this module installed on a client's forum. Currently the moderators vet all posts before they are made visible on the site, however the module sends an email to all members as soon as the post is created. Is there any way of delaying the emails until the post has been approved?

If not, can you recommend any alternative methods as I may be able to persuade my client to make some trade-offs?

Many thanks,

David



Edited 1 time(s). Last edit at 07/24/2007 10:43AM by dkdo.
Re: Group Auto-Email Module
July 24, 2007 08:43PM
David,

This is no current way that I know of to do what you want without hacking the phorum code. The good news is that the hacks you want are not difficult. Follow these steps and it should work the way you want it too. FYI, red=remove lines, green=add lines

First:
Edit \mods\group_autoemail\info.txt
hook: post_post|phorum_mod_group_autoemail_post_post
hook: post_approval|phorum_mod_group_autoemail_post_post

Second:
Edit \inclue\posting\action_post.php starting at line 168
    // Actions for messages which are approved.
    if ($message["status"] > 0)
    {
        // Update forum statistics.
        phorum_db_update_forum_stats(false, 1, $message["datestamp"]);

        // Mail subscribed users.
        phorum_email_notice($message);

        //Run mods after approval.
        $message = phorum_hook("post_approval", $message);
    }

Third:
Edit \moderation.php starting at line 228
    case PHORUM_APPROVE_MESSAGE: // approving a message

        $PHORUM['DATA']['MESSAGE']="1 ".$PHORUM["DATA"]['LANG']['MsgApprovedOk'];

        $old_message = phorum_db_get_message($msgthd_id);
        $newpost=array("status"=>PHORUM_STATUS_APPROVED);

        // setting the new status
        phorum_db_update_message($msgthd_id, $newpost);

        // updating the thread-info
        phorum_update_thread_info($old_message['thread']);

        // updating the forum-stats
        phorum_db_update_forum_stats(false, 1, $old_message["datestamp"]);

	// Run mods after message approval.
        $message = phorum_hook("post_approval", $old_message);

        if($old_message['status'] != PHORUM_STATUS_HIDDEN ) {
          phorum_email_notice($old_message);
        }

        if(isset($PHORUM['args']['old_forum']) && is_numeric($PHORUM['args']['old_forum']) && $PHORUM['folder_flag'] && $old_message['sort'] == PHORUM_SORT_ANNOUNCEMENT) {
            $PHORUM['forum_id']=(int)$PHORUM['args']['old_forum'];
        }


        if(isset($PHORUM['args']["prepost"])) {
            $PHORUM['DATA']["URL"]["REDIRECT"]=phorum_get_url(PHORUM_CONTROLCENTER_URL,"panel=".PHORUM_CC_UNAPPROVED);
        } else {
            $PHORUM['DATA']["URL"]["REDIRECT"]=$PHORUM["DATA"]["URL"]["TOP"];
        }
        break;

Once you have edited and saved those three files, go into the module area of the phorum admin page, turn off the Group Auto_Email module, and turn it back on. Now all posts that are unapproved will not be emailed out until approved. If approval is not needed, the email will go out.

Hope that helps, please let me know if it fixes your problem or not.


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 07/25/2007 07:23AM by Azumandias.
Re: Group Auto-Email Module
July 25, 2007 02:16AM
There's a problem in there. "post_approve" in the info.txt module info should read "post_approval", else it won't match the name for the added hook calls.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Group Auto-Email Module
July 25, 2007 04:52AM
Thanks very much for the quick response! I've made these changes and will report back if I have any problems.

Best regards,

David
Re: Group Auto-Email Module
July 25, 2007 07:22AM
Maurice,

Thanks, that was the one I didn't copy/paste. Darn my ignorant fingers :) I will edit the original post so others won't get tripped up by not looking further.

Am I correct in assuming there is no way to do this without the hack I used?


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 2 time(s). Last edit at 07/25/2007 07:28AM by Azumandias.
Re: Group Auto-Email Module
July 25, 2007 10:34AM
Not as easy as this anyway. In post_post, you could also check for the state of the message and using a hook from moderation.php you can also handle the mail sending. But your hooks make it a no brainer. We might consider adding those to the core for Phorum 5.2, since they are quite useful IMO.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login