-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomment-notification-manager.php
More file actions
73 lines (56 loc) · 1.89 KB
/
comment-notification-manager.php
File metadata and controls
73 lines (56 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/*
Plugin Name: Comment Notification Manager
Plugin URI:
Description:
Version: 1.0.0
Author: BlueSuiter
Author URI:
Donate link:
License: GPL2
*/
if(!defined('ABSPATH'))
{
die;
}
if(file_exists(dirname(__FILE__) . '/admin/admin-interface.php'))
{
require_once(dirname(__FILE__) . '/admin/admin-interface.php');
$_cnmAdminInterface = new _cnmAdminInterface();
add_action('wp_ajax_userList', array($_cnmAdminInterface, 'handleUserManageList'));
add_action('wp_ajax_cnm_updater', array($_cnmAdminInterface, 'handleNotificationReciever'));
add_action('admin_menu', array($_cnmAdminInterface, '_cnmAddAdminPages'));
}
if(file_exists(dirname(__FILE__) . '/mail/comment-email.php'))
{
require_once(dirname(__FILE__) . '/mail/comment-email.php');
new Custom_Comment_Email();
}
function _cnmCommentModerationRecipients($emails, $comment_id)
{
$comment = get_comment($comment_id);
$post = get_post($comment->comment_post_ID);
$forwardTo = get_user_meta($post->post_author, 'comment_notification_forward', true);
/*/ Return the email which meant to recieve mail for a post.*/
if (!empty(trim($forwardTo)))
{
$user = get_user_by('id', $forwardTo);
}
else
{
$user = get_user_by('id', $post->post_author);
}
return array($user->user_email);
}
add_filter('comment_moderation_recipients', '_cnmCommentModerationRecipients', 11, 2);
add_filter('comment_notification_recipients', '_cnmCommentModerationRecipients', 11, 2);
if(!function_exists('handlePostData'))
{
function handlePostData($key)
{
if(isset($_POST[$key]))
{
return $_POST[$key];
}
}
}