diff --git a/e107_plugins/forum/e_notify.php b/e107_plugins/forum/e_notify.php
index b93fb3205..0a675c90b 100644
--- a/e107_plugins/forum/e_notify.php
+++ b/e107_plugins/forum/e_notify.php
@@ -33,34 +33,40 @@ class forum_notify extends notify
$config[] = array(
'name' => LAN_FORUM_NT_NEWTOPIC_PROB,
- 'function' => "forum_ntp",
+ //'function' => "forum_ntp",
+ 'function' => "user_forum_topic_created_probationary",
'category' => ''
);
$config[] = array(
'name' => LAN_FORUM_NT_TOPIC_DELETED,
- 'function' => "forum_topic_del",
+ //'function' => "forum_topic_del",
+ 'function' => "user_forum_topic_deleted",
'category' => ''
);
-
+/*
+ // todo: implement thread split
$config[] = array(
'name' => LAN_FORUM_NT_TOPIC_SPLIT,
- 'function' => "forum_topic_split",
+ //'function' => "forum_topic_split",
+ 'function' => "user_forum_topic_split",
'category' => ''
);
-
+*/
$config[] = array(
'name' => LAN_FORUM_NT_POST_DELETED,
- 'function' => "forum_post_del",
+ //'function' => "forum_post_del",
+ 'function' => "user_forum_post_deleted",
'category' => ''
);
$config[] = array(
'name' => LAN_FORUM_NT_POST_REPORTED,
- 'function' => "forum_post_rep",
+ //'function' => "forum_post_rep",
+ 'function' => "user_forum_post_report",
'category' => ''
);
-
+
return $config;
}
@@ -74,61 +80,188 @@ class forum_notify extends notify
[s] = subject
[m] = message
[d] = deleted by
+ [p] = post id
*/
- if (!isset($data['post_id']) || intval($data['post_id']) < 1) return;
+ if (isset($data['id']) && isset($data['data']))
+ {
+ $message = 'Notify test: New thread created';
+ }
+ else
+ {
+ if(!isset($data['post_id']) || intval($data['post_id']) < 1)
+ {
+ return;
+ }
- $threadid = $data['thread_id'];
+ $sef = $data['thread_sef'];
- $sql = e107::getDb();
- $tmp = $sql->gen('SELECT u.user_loginname, f.forum_name, f.forum_sef, t.thread_id, t.thread_name, p.post_entry
- FROM `#forum_post` AS p
- LEFT JOIN `#user` AS u ON (p.post_user = u.user_id)
- LEFT JOIN `#forum_thread` AS t ON (t.thread_id = p.post_thread)
- LEFT JOIN `#forum` AS f ON (f.forum_id = t.thread_forum_id)
- WHERE p.post_id = '.intval($data['post_id']));
-
- if ($tmp) $data = $sql->fetch();
- else return;
+ $sql = e107::getDb();
+ if($sql->gen('SELECT f.forum_name, f.forum_sef, t.thread_id, t.thread_name, p.post_entry
+ FROM `#forum_post` AS p
+ LEFT JOIN `#forum_thread` AS t ON (t.thread_id = p.post_thread)
+ LEFT JOIN `#forum` AS f ON (f.forum_id = t.thread_forum_id)
+ WHERE p.post_id = ' . intval($data['post_id'])))
+ {
+ $data = $sql->fetch();
+ }
+ else
+ {
+ return;
+ }
- $message = e107::getParser()->lanVars(LAN_FORUM_NT_NEWTOPIC_MSG, array(
- 'u' => USERNAME,
- 'f' => $data['forum_name'],
- 's' => $data['thread_name'],
- 'm' => $data['post_entry'],
- 'l' => e107::url('forum', 'topic', array('thread_id'=>$data['thread_id'], 'thread_name'=>$data['thread_name'], 'forum_sef' => $data['forum_sef']), array('mode' => 'full'))
- ));
+ $message = e107::getParser()->lanVars(LAN_FORUM_NT_NEWTOPIC_MSG, array(
+ 'u' => USERNAME,
+ 'f' => $data['forum_name'],
+ 's' => $data['thread_name'],
+ 'm' => $data['post_entry'],
+ 'l' => e107::url('forum', 'topic', array('thread_id' => $data['thread_id'], 'thread_sef' => $sef, 'forum_sef' => $data['forum_sef']), array('mode' => 'full'))
+ ));
+ }
$this->send('user_forum_topic_created', LAN_PLUGIN_FORUM_NAME, $message);
+ return true;
}
- function forum_ntp($data)
+ //function forum_ntp($data)
+ function user_forum_topic_created_probationary($data)
{
- $message = 'todo';
- $this->send('forum_nt', LAN_FORUM_NT_7, $message);
+ if (isset($data['id']) && isset($data['data']))
+ {
+ $message = 'Notify test: New thread (probationary) created';
+ }
+ else
+ {
+ if(!isset($data['post_id']) || intval($data['post_id']) < 1)
+ {
+ return;
+ }
+
+ $sef = $data['thread_sef'];
+
+ $sql = e107::getDb();
+ if($sql->gen('SELECT f.forum_name, f.forum_sef, t.thread_id, t.thread_name, p.post_entry
+ FROM `#forum_post` AS p
+ LEFT JOIN `#forum_thread` AS t ON (t.thread_id = p.post_thread)
+ LEFT JOIN `#forum` AS f ON (f.forum_id = t.thread_forum_id)
+ WHERE p.post_id = ' . intval($data['post_id'])))
+ {
+ $data = $sql->fetch();
+ }
+ else
+ {
+ return;
+ }
+
+
+ $message = e107::getParser()->lanVars(LAN_FORUM_NT_NEWTOPIC_PROB_MSG, array(
+ 'u' => USERNAME,
+ 'f' => $data['forum_name'],
+ 's' => $data['thread_name'],
+ 'm' => $data['post_entry'],
+ 'l' => e107::url('forum', 'topic', array('thread_id' => $data['thread_id'], 'thread_sef' => $sef, 'forum_sef' => $data['forum_sef']), array('mode' => 'full'))
+ ));
+ }
+
+ $this->send('user_forum_topic_created_probationary', LAN_FORUM_NT_7, $message);
}
- function forum_topic_del($data)
+ //function forum_topic_del($data)
+ function user_forum_topic_deleted($data)
{
- $message = 'todo';
- $this->send('forum_topic_del', LAN_FORUM_NT_8, $message);
+ if (isset($data['id']) && isset($data['data']))
+ {
+ $message = 'Notify test: Thread deleted';
+ }
+ else
+ {
+ if(isset($data['thread_id']) && intval($data['thread_id']) < 1)
+ {
+ return;
+ }
+
+ $message = e107::getParser()->lanVars(LAN_FORUM_NT_TOPIC_DELETED_MSG, array(
+ 'd' => USERNAME,
+ 'f' => $data['forum_name'],
+ 's' => $data['thread_name'],
+ 'l' => e107::url('forum', 'forum', array('forum_id' => $data['forum_id'], 'forum_sef' => $data['forum_sef']), array('mode' => 'full'))
+ ));
+ }
+
+ $this->send('user_forum_topic_deleted', LAN_FORUM_NT_8, $message);
}
- function forum_topic_split($data)
+ //function forum_topic_split($data)
+ function user_forum_topic_split($data)
{
- $message = 'todo';
+ if (isset($data['id']) && isset($data['data']))
+ {
+ $message = 'Notify test: Topic splitted';
+ }
+ else
+ {
+ $message = $data;
+ }
+
$this->send('forum_topic_split', LAN_FORUM_NT_9, $message);
}
- function forum_post_del($data)
+ //function forum_post_del($data)
+ function user_forum_post_deleted($data)
{
- $message = 'todo';
- $this->send('forum_post_del', LAN_FORUM_NT_10, $message);
+ if (isset($data['id']) && isset($data['data']))
+ {
+ $message = 'Notify test: Post deleted';
+ }
+ else
+ {
+ if(isset($data['post_id']) && intval($data['post_id']) < 1)
+ {
+ return;
+ }
+
+ $entry = $data['post_entry'];
+ $postid = $data['post_id'];
+
+ $sql = e107::getDb();
+ if($sql->gen('SELECT f.forum_name, f.forum_sef, t.thread_id, t.thread_name
+ FROM `#forum_thread` AS t
+ LEFT JOIN `#forum` AS f ON (f.forum_id = t.thread_forum_id)
+ WHERE t.thread_id = ' . intval($data['post_thread'])))
+ {
+ $data = $sql->fetch();
+ }
+ else
+ {
+ return;
+ }
+
+ $sef = eHelper::title2sef($data['thread_name'],'dashl');
+
+ $message = e107::getParser()->lanVars(LAN_FORUM_NT_POST_DELETED_MSG, array(
+ 'd' => USERNAME,
+ 'f' => $data['forum_name'],
+ 's' => $data['thread_name'],
+ 'p' => $postid,
+ 'm' => $entry,
+ 'l' => e107::url('forum', 'topic', array('thread_id' => $data['thread_id'], 'thread_sef' => $sef, 'forum_sef' => $data['forum_sef']), array('mode' => 'full'))
+ ));
+ }
+ $this->send('user_forum_post_deleted', LAN_FORUM_NT_10, $message);
}
- function forum_post_rep($data)
+ //function forum_post_rep($data)
+ function user_forum_post_report($data)
{
- $message = 'todo';
+ if (isset($data['id']) && isset($data['data']))
+ {
+ $message = 'Notify test: Post reported';
+ }
+ else
+ {
+ $message = $data;
+ }
+
$this->send('forum_post_rep', LAN_FORUM_NT_11, $message);
}
diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php
index 6bc73b2bc..c33a75fee 100644
--- a/e107_plugins/forum/forum_class.php
+++ b/e107_plugins/forum/forum_class.php
@@ -870,7 +870,15 @@ class e107forum
$triggerData['thread_sef'] = $threadInfo['thread_sef'];
$triggerData['post_id'] = $newPostId;
- e107::getEvent()->trigger('user_forum_topic_created', $triggerData);
+
+ if (e107::getDb()->count('forum_post', '(post_id)', 'WHERE post_user = "'.USERID.'"') > 0)
+ {
+ e107::getEvent()->trigger('user_forum_topic_created', $triggerData);
+ }
+ else
+ {
+ e107::getEvent()->trigger('user_forum_topic_created_probationary', $triggerData);
+ }
return array('postid' => $newPostId, 'threadid' => $newThreadId, 'threadsef'=>$threadInfo['thread_sef']);
}
@@ -2344,7 +2352,7 @@ class e107forum
if($sql->delete('forum_thread', 'thread_id='.$threadId))
{
$status = true;
- e107::getEvent()->trigger('user_forum_topic_deleted', $threadId);
+ e107::getEvent()->trigger('user_forum_topic_deleted', $threadInfo);
}
//Delete any thread tracking
@@ -2376,9 +2384,11 @@ class e107forum
$postId = (int)$postId;
$e107 = e107::getInstance();
$sql = e107::getDb();
- $deleted = false;
-
- if(!$sql->select('forum_post', '*', 'post_id = '.$postId))
+ $deleted = false;
+
+ $postInfo = $sql->retrieve('forum_post', '*', 'post_id = '.$postId);
+ //if(!$sql->select('forum_post', '*', 'post_id = '.$postId))
+ if(!is_array($postInfo) || empty($postInfo))
{
echo 'NOT FOUND!'; return;
}
@@ -2396,7 +2406,7 @@ class e107forum
if($sql->delete('forum_post', 'post_id='.$postId))
{
$deleted = true;
- e107::getEvent()->trigger('user_forum_post_deleted', $postId);
+ e107::getEvent()->trigger('user_forum_post_deleted', $postInfo);
}
// update statistics
diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php
index a24763afc..5bb8512db 100644
--- a/e107_plugins/forum/forum_post.php
+++ b/e107_plugins/forum/forum_post.php
@@ -309,10 +309,13 @@ class forum_post_handler
$link = "{e_PLUGIN}forum/forum_admin.php?mode=post&action=list&id=".intval($result);
+
$report = LAN_FORUM_2018." ".SITENAME." : ".$link . "\n
".LAN_FORUM_2019.": ".USERNAME. "\n" . $report_add;
- $subject = LAN_FORUM_2020." ". SITENAME;
- e107::getNotify()->send('forum_post_rep', $subject, $report);
+ //$subject = LAN_FORUM_2020." ". SITENAME;
+
+ //e107::getNotify()->send('forum_post_rep', $subject, $report);
+ e107::getEvent()->trigger('user_forum_post_report', $report);
e107::getRender()->tablerender(LAN_FORUM_2023, $text, 'forum-post-report');
}
diff --git a/e107_plugins/forum/languages/English/English_notify.php b/e107_plugins/forum/languages/English/English_notify.php
index 9007dd709..8b973c98f 100644
--- a/e107_plugins/forum/languages/English/English_notify.php
+++ b/e107_plugins/forum/languages/English/English_notify.php
@@ -7,7 +7,7 @@ define("LAN_FORUM_NT_8", "Forum - Thread deleted");
define("LAN_FORUM_NT_9", "Forum - Thread split");
define("LAN_FORUM_NT_10", "Forum - Post deleted");
define("LAN_FORUM_NT_11", "Forum - Post reported");
-define("LAN_FORUM_NT_12", "Forum - Post created");
+//define("LAN_FORUM_NT_12", "Forum - Post created");
define("LAN_FORUM_NT_NEWTOPIC", "New topic created");
define("LAN_FORUM_NT_NEWTOPIC_PROB", "New topic created by probationary member");
@@ -15,15 +15,17 @@ define("LAN_FORUM_NT_TOPIC_DELETED", "Topic deleted");
define("LAN_FORUM_NT_TOPIC_SPLIT", "Topic split");
define("LAN_FORUM_NT_POST_DELETED", "Post deleted");
define("LAN_FORUM_NT_POST_REPORTED", "Post reported");
-define("LAN_FORUM_NT_POST_CREATED", "Post created");
+//define("LAN_FORUM_NT_POST_CREATED", "Post created");
-define("LAN_FORUM_NT_NEWTOPIC_MSG", "Forum thread created by: [u] (Forum name: [f])
Subject: [s]
Message:
[m]
");
-define("LAN_FORUM_NT_NEWTOPIC_PROB_MSG", "Forum thread created by: [u] (Forum name: [f])
Subject: [s]
Message:
[m]
");
+define("LAN_FORUM_NT_NEWTOPIC_MSG", "New thread in forum [f] created by: [u]
Subject: [s]
Message:
[m]
");
+define("LAN_FORUM_NT_NEWTOPIC_PROB_MSG", "New thread in forum [f] created by new user: [u]
Subject: [s]
Message:
[m]
");
-define("LAN_FORUM_NT_POST_CREATED_MSG", "Forum message created by: [u] (Forum name: [f])
Message:
[m]
");
-define("LAN_FORUM_NT_TOPIC_DELETED_MSG", "Forum thread created by: [u] (Forum name: [f])
Subject: [s]
Forum thread deleted by:
[d]
Message: [m]
[m]
");
+//define("LAN_FORUM_NT_POST_CREATED_MSG", "New message in thread [s] (Forum name: [f]) created by: [u]
Message:
[m]
");
+define("LAN_FORUM_NT_TOPIC_DELETED_MSG", "Thread [s] in forum [f] deleted by: [d]
");
+define("LAN_FORUM_NT_POST_DELETED_MSG", "Post #[p] of thread [s] in forum [f] deleted by: [d]
Message:
[m]
");
+/*
// Forum Notify Types
define('NT_LAN_FT_1', 'Forum Events');
define('NT_LAN_FO_1', 'Forum thread posted');
@@ -48,4 +50,5 @@ define('NT_LAN_FM_5', 'New subject');
define('NT_LAN_FM_6', 'Old (source) forum name');
define('NT_LAN_FM_7', 'New (destination) forum name');
define('NT_LAN_FM_8', 'Forum thread is moved');
-define('NT_LAN_FM_9', 'Forum thread is moved by');
\ No newline at end of file
+define('NT_LAN_FM_9', 'Forum thread is moved by');
+*/
\ No newline at end of file