[BETA] Notify ADMIN of all posts

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
amoun
Registered User
Posts: 251
Joined: Mon Sep 29, 2003 1:15 pm
Location: Cornwall, UK SX45036904
Contact:

[BETA] Notify ADMIN of all posts

Post by amoun »

Hi.

This MOD is for those of us who, as yet, have few posts and don't want to check the fora many times a day. So it emails ADMIN the site name, forum name and the text of any new post, reply or edit. It then provides a link to the post.

It's very simple, if it works :lol:

All the code is in a new file called includes/notify_on_all_posts.php and is as follows :-

Code: Select all

<?php
/************ - - notify_on_all_posts.php - - *************
 *                          
 *  Author      : Roger Lovejoy
 *  Copywrite   : GNU
 *  Created     : Sunday, Jun 6th, 2004
 *  Version     : 0.0.1
 *  Support     : rogerlovejoy.co.uk/soapbox
 *
 **********************************************************/

// USE SQL to get Site Name, Forum Name and Post Text from database
$sql = "SELECT config_value
           FROM " . CONFIG_TABLE . "
           WHERE config_name = 'sitename'";
           if ( $result = $db->sql_query($sql) )
        {
           $row = $db->sql_fetchrow($result);
           $sitename = $row['config_value'];
        }

$sql = "SELECT forum_name
            FROM " . FORUMS_TABLE . "
            WHERE forum_id = $forum_id";
            if ( $result = $db->sql_query($sql) )
        {
            $row = $db->sql_fetchrow($result);
            $forumname = $row['forum_name'];
        }

$sql = "SELECT post_text
           FROM " . POSTS_TEXT_TABLE . "
           WHERE post_id = $post_id";
           if ( $result = $db->sql_query($sql) )
        {
           $row = $db->sql_fetchrow($result);
           $lastpost = $row['post_text'];
        }
        
// SET Variables for mail function
        $domain = ($board_config['server_name']);
        $folder = ($board_config['script_path']);
        $message_link = $domain . $folder . "viewtopic.php?p=" . $post_id;
        $to  = $board_config['board_email'];
        $subject = "NEW POST on " . $sitename . " (" . $forumname . ")" ;
        $content = $lastpost . "\r\n\r" . $message_link;
	
// Notify Admin of all posts
   if ($mode == 'newtopic' || $mode == 'reply' || $mode == 'editpost')
   {
      mail($to, $subject, $content, "From:" . $to );
   }
// EOF
?>
It's executed via an include in <includes/functions_post.php> buy adding the following lines at the end of the function - function submit_post - just before the return false; (This is around line 360 in a virgin version (2.0.6) of functions_post.php)

The lines to add are

Code: Select all

// BEGIN MOD : Admin Notify On All Posts
include($phpbb_root_path . 'includes/notify_on_all_posts.'.$phpEx);
// END MOD : Admin Notify On All Posts
OK that's it.

In a nutshell

1. Make a new file called <notify_on_all_posts.php> with the first code above and put the new file in the includes folder

2. Add the include MOD as instructed to <functions_post.php>

Thanks for reading this. Please let me know if it works for you :roll:
facts invariably distort the truth

safeTsurfa
I've Been Banned!
Posts: 1959
Joined: Sat May 08, 2004 10:21 am
Location: United Kingdom
Contact:

Post by safeTsurfa »

Wow a BETA already! Daring, adventurous, and bold.... Pendragon had nothing on you! :lol:
safeTsurfa
Need help? First READ THIS
Personal projects: My Mods

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

It took - what - all of 30 seconds installing this mod. I tested it and it works perfectly. I had really been looking for a mod like this. PERFECT!!! :D

User avatar
morpheus2matrix
Former Team Member
Posts: 9171
Joined: Wed Apr 10, 2002 7:31 pm
Location: France
Contact:

Post by morpheus2matrix »

Could you please use the correct MOD Template :?:

Thank
Former phpBB MOD-Team Member -

Forgive my bad English :(

No support by PM/Email - Thanks - You can thanks me here :) - Pay me for installing MOD's :lol:

amoun
Registered User
Posts: 251
Joined: Mon Sep 29, 2003 1:15 pm
Location: Cornwall, UK SX45036904
Contact:

Post by amoun »

Dear morpheus2matrix.

I'd be glad to use the MOD template but I'm not sure what you mean. :? I tried using the other MOD forum to submit an earlier version of my MOD for validation but it wasn't accepted due to some syntax error on the AUTHOR line - couldn't get around it.

Since then I've updated the MOD and thought this was the forum for an informal advert and informal critique.

What have I done wrong? :cry: Can you enlighten me as to a better way of providing the MOD?

Thank you for your attention.

EDIT @ 20:47

Hi morph. I managed to get the Validation thing working so I've posted it under the Admin Tools section of the MODS Database thingy. I only hope I've done it right.

Where's the emoticon for sweating :)
facts invariably distort the truth

safeTsurfa
I've Been Banned!
Posts: 1959
Joined: Sat May 08, 2004 10:21 am
Location: United Kingdom
Contact:

Post by safeTsurfa »

What Morpheus is saying, is you need to package the MOD and host it as a file at your site for download, then submit your instructions file here following the MOD template with a link for the download. You shouldn't simply post here the code of the included file you have created with a bunch of instructions as normal text to explain it.

Code: Select all

############################################################## 
## MOD Title: Notify Admin On All Posting
## MOD Author: Roger Lovejoy < webmaster@rogerlovejoy.co.uk > (Roger Lovejoy) http://www.rogerlovejoy.co.uk
## MOD Description: This MOD is for those of us who, as yet, have few posts and don't 
## want to check the fora many times a day. So it emails ADMIN the site name, forum 
## name and the text of any new post, reply or edit. It then provides a link to the post.
## MOD Version: 1.0.0
## 
## Installation Level: easy 
## Installation Time: 5 Minutes 
## Files To Edit: 1 
##	includes/functions_post.php
## Included Files: 1 
##	notify_on_all_posts.php
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## This release is a Beta version for users to test and report errors. This MOD has 
## been tested against phpBB 2.0.6 clean install, using the subSilver template. The 
## author is unable to test against earlier versions, or against portals, so can give 
## no assurance that it will function correclty with such installations. Please 
## remember this is a beta, and should be tested on a non-working installation of 
## the phpBB forums, and all testing is done at the user's own risk.
############################################################## 
## MOD History: 
##
## 2004-06-06 - Version 1.0.0 (beta)
## - Released initial beta version for public testing
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ COPY ]------------------------------------------ 
#
copy notify_on_all_posts.php to includes/notify_on_all_posts.php

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions_post.php

# 
#-----[ FIND ]------------------------------------------ 
# 
	return false;
}

//
// Update post stats and details
//

#
#-----[ BEFORE, ADD ]------------------------------------------ 
#
// BEGIN MOD : Notify Admin On All Posting 
include($phpbb_root_path . 'includes/notify_on_all_posts.'.$phpEx); 
// END MOD : Notify Admin On All Posting
        
# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------- 
# 
# EoM
(Edited post - made error in the COPY instruction - corrected)
Last edited by safeTsurfa on Sun Jun 06, 2004 9:20 pm, edited 2 times in total.
safeTsurfa
Need help? First READ THIS
Personal projects: My Mods

amoun
Registered User
Posts: 251
Joined: Mon Sep 29, 2003 1:15 pm
Location: Cornwall, UK SX45036904
Contact:

Post by amoun »

safeTsurfa wrote: What Morpheus is saying, is you need to package the MOD and host it as a file at your site for download, then submit your instructions file here following the MOD template with a link for the download. You shouldn't simply post here the code of the included file you have created with a bunch of instructions as normal text to explain it.


Hi sTs - see my private message too

Otherwise I think I've done the
package the MOD and host it as a file at your site for download,

and I hope the instructions on the first post, above, are OK

and here's a link to download the MOD :- http://rogerlovejoy.info/computer/downl ... _admin.zip

although why do I need to put a link to my server - I thought that was what the MOD database was for. :?

EDIT @ 21.44

OK I think I know what to do - Copy the Template Here :)

Will do it later tonight hopefully

Thanks sTs and m2m
facts invariably distort the truth

safeTsurfa
I've Been Banned!
Posts: 1959
Joined: Sat May 08, 2004 10:21 am
Location: United Kingdom
Contact:

Post by safeTsurfa »

You may hae submitted the MOD to the database, but until it has been validated and released by the MOD team, it will not show up. The database if for final version and fully working error-free MODs which meet approval of the MOD team. You need to host the beta yourself during testing. See my PM to you re. this.
safeTsurfa
Need help? First READ THIS
Personal projects: My Mods

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

Suggestion;

Howabout including post author in the email?

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

Also,
the emails don't resolve the BBCode. For instance I got this;

[b:d178b62209]Test[/b:d178b62209]:

Is it possible to fix this..?

Just a suggestion and once again, a very helpful MOD.

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati »

Oh, and here's one more;

Howabout making the MOD an option in the ACP general board configuration....

amoun
Registered User
Posts: 251
Joined: Mon Sep 29, 2003 1:15 pm
Location: Cornwall, UK SX45036904
Contact:

Post by amoun »

Hi Joe Belmaati
[Suggestion;

Howabout including post author in the email?

OK This one I can probably do :)

[Also,
the emails don't resolve the BBCode. For instance I got this;

[b:d178b62209]Test[/b:d178b62209]:

Is it possible to fix this..?

Just a suggestion and once again, a very helpful MOD.

Probably possible, but I'm not going to think about for now/ever. Putting the post in the email was an after thought as originally I only wanted to know there was a post - so maybe I should remove the post text from the content. Interesting from a programming view - as I'm only just learning. So don't hold your breath on this one
Oh, and here's one more;

Howabout making the MOD an option in the ACP general board configuration....

:? Don't have much of a clue here but I could look into the idea - again don't hold your breath waiting for me to do it - try and work it out yourself :roll:
facts invariably distort the truth

amoun
Registered User
Posts: 251
Joined: Mon Sep 29, 2003 1:15 pm
Location: Cornwall, UK SX45036904
Contact:

Post by amoun »

Joe Belmaati wrote: Suggestion;

Howabout including post author in the email?


How about this :-

Change line 46 from :-

Code: Select all

$content = $lastpost . "\r\n\r" . $message_link ;
	
to this :-

Code: Select all

$content = "Submitted by :- " . $userdata['username']. "\r\n\r" . $lastpost . "\r\n\r" . $message_link ;
Last edited by amoun on Mon Jun 21, 2004 10:26 pm, edited 1 time in total.
facts invariably distort the truth

GiddyBoy
Registered User
Posts: 42
Joined: Wed Dec 11, 2002 6:30 pm

Post by GiddyBoy »

Can this be adjusted to include other users aside from the admin?

GiddyBoy
Registered User
Posts: 42
Joined: Wed Dec 11, 2002 6:30 pm

Post by GiddyBoy »

Very nice mod. Thank you!

Post Reply

Return to “[2.0.x] MODs in Development”