Quantcast
Channel: Group Auto-Email Module
Viewing all articles
Browse latest Browse all 60

Re: Group Auto-Email Module

$
0
0
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.

Viewing all articles
Browse latest Browse all 60

Trending Articles