Moderator notification about new topics

I will no longer provide phpBB2 support due to phpBB2's EOL announcement. If you need help with phpBB2 you can try phpBB2 Refugees.
Locked
WK_tmp
Posts: 12
Joined: Fri Jan 19, 2007 2:50 am
Contact:

Moderator notification about new topics

Post by WK_tmp » Thu Feb 08, 2007 6:34 am

Hi,

may be I simply missed something in user profile settings and forum access :cry:

I wonder how moderator, in general case any registered user, can subscribe on notification by e-mail about NEW topics in moderated forum?

Are anywere specific mods for this feature?

Brf
Expert
Posts: 3
Joined: Fri Oct 27, 2006 8:13 pm
Contact:

Post by Brf » Thu Feb 08, 2007 6:51 am

That mod notifies Moderators of new topics. There is no profile setting to affect it.
I have no signature

WK_tmp
Posts: 12
Joined: Fri Jan 19, 2007 2:50 am
Contact:

Post by WK_tmp » Thu Feb 08, 2007 7:28 am

Brf wrote:That mod notifies Moderators of new topics. There is no profile setting to affect it.
That mod - is not clear for me.
What the mod do you mean? phpBB2.0.22 itself?

At the time I found "Forum Watch" mod on http://www.phpBB.com.
MOD Description: Allows forum users to watch a forum for new topics.

User avatar
DavidIQ
Site Admin
Posts: 581
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Post by DavidIQ » Thu Feb 08, 2007 7:44 am

I have the "Admin New Topic Notifier" installed on here with a slight modification of my own to also notify moderators (well...moderator as I only have one :wink: ). With a few modifications you can make it work for your purposes as well. Here is the mod in its modified state:

Code: Select all

##############################################################
## MOD Title: Easy Topic Notifier
## MOD Author: DavidIQ (original by: StefanKausL < stefan@kuhlins.de > (Stefan Kuhlins) http://kuhlins.de/)
## MOD Description: This simple MOD notifies admins and moderators by email of new topics.
## MOD Version: 1.0
##
## Installation Level:	Easy
## Installation Time:	1 Minute
## Files To Edit: includes/functions_post.php
##
## Included Files: easy_admin_topic_notifier.tpl
##############################################################
## 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 MOD is especially useful for seldom used forums.
##
## The template for the email is copied to the English directory.
## If you want to support different languages change the statement
## $emailer->use_template('easy_admin_topic_notifier', 'english');
## to
## $emailer->use_template('easy_admin_topic_notifier', $row['user_lang']);
## and copy localized versions of the template file
## easy_admin_topic_notifier.tpl in every language directory.
##############################################################
## MOD History:
##
##   2007-02-08 - Version 1.0
##       Adaptation of easy admin topic notifier
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ COPY ]---------------------------------------------
#
copy easy_admin_topic_notifier.tpl to language/lang_english/email/easy_admin_topic_notifier.tpl

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

#
#-----[ FIND ]---------------------------------------------
#
			$topic_id = $db->sql_nextid();

#
#-----[ AFTER, ADD ]---------------------------------------------
#
			sk_send_mail_to_admins($topic_id, $post_subject);

#
#-----[ FIND ]---------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
function sk_send_mail_to_admins($topic_id, $post_subject) {
	global $board_config, $lang, $db, $phpbb_root_path, $phpEx;

	include($phpbb_root_path . 'includes/emailer.'.$phpEx);
	$emailer = new emailer($board_config['smtp_delivery']);

	$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
	$script_name = ($script_name != '') ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
	$server_name = trim($board_config['server_name']);
	$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
	$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';

	$sql = "SELECT user_email, user_lang FROM " . USERS_TABLE . " WHERE user_level IN(" . ADMIN . ", " . MOD . ")";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
	}

	while ($row = $db->sql_fetchrow($result))
	{
		$emailer->email_address(trim($row['user_email']));
		$emailer->use_template('easy_admin_topic_notifier', 'english');  // See Notes!
		$emailer->from($board_config['board_email']);
		$emailer->set_subject($lang['New_post']);
		$emailer->assign_vars(array(
			'SITENAME' => $board_config['sitename'],
			'TOPIC_TITLE' => $post_subject,
			'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "=$topic_id",
			'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '')
		);
		$emailer->send();
		$emailer->reset();
	}
	$db->sql_freeresult($result);
}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
This is the only difference:

Code: Select all

	$sql = "SELECT user_email, user_lang FROM " . USERS_TABLE . " WHERE user_level IN(" . ADMIN . ", " . MOD . ")";
This would notify all admin users and all moderators of new topics. If you wanted to have the notification only sent to moderators of a specific forum you can try manipulating the sql part a bit to achieve this. It would require a bit of research to figure it out but shouldn't be too hard especially since the post_id is already passed to the function. If this sounds like another language to you just reply and say so...

WK_tmp
Posts: 12
Joined: Fri Jan 19, 2007 2:50 am
Contact:

Replies Notification

Post by WK_tmp » Fri Feb 16, 2007 7:29 am

Something is wrong with replies notification.

Today (Feb 16) I've got by e-mail following notification:
Hello,

You are receiving this email because you are watching the topic, "Moderator notification about new topics" at David IQ phpBB MODs Demo & Support. This topic has received a reply since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic.

viewtopic.php?p=369#369

If you no longer wish to watch this topic you can either click the "Stop watching this topic link" found at the bottom of the topic above, or by clicking the following link:

viewtopic.php?t=71&unwatch=topic

--
Thanks, The Management
The 1-st link is empty and really I should be directed to viewtopic.php?t=71

Another strangeness is that of this topic was not replied by nobody since Feb, 8. So reply notification system has bug.

User avatar
DavidIQ
Site Admin
Posts: 581
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Post by DavidIQ » Fri Feb 16, 2007 7:42 am

No nothing is wrong and the link is (or was) correct. That's the same format any standard phpBB sends topic reply notifications in. Brings up the topic on the page of the posting that the reply was made. What happened was that there was a sudden bombardment of spam on here and this topic was one of the victims. You got here after the cleanup ;-)

BTW I believe the reason this happened is because this website has been posted on phpBB many times. Take that as a warning of what you may be up against should you do the same.

Locked