Comments – wpDiscuz - Version 4.0.14

Version Description

  • Fixed Bug: Use backslash symbol in comment textarea: '\'
  • Fixed Bug: Loose custom field data on comment editing

IMPORTANT:

  • If you have JetPack installed please deactivate Jetpack comments, it affects wpDiscuz
  • If you have a Cache Plugin, please delete all caches after wpDiscuz update.
  • If you use CDN and found some issue please purge it.
  • If your server PHP version is lower than 5.4, please change it to hogher
Download this release

Release Info

Developer AdvancedCoding
Plugin Icon 128x128 Comments – wpDiscuz
Version 4.0.14
Comparing to
See all releases

Code changes from version 4.0.13 to 4.0.14

assets/js/wpdiscuz.js CHANGED
@@ -401,12 +401,16 @@ jQuery(document).ready(function ($) {
401
  if (storeCommenterData == null) {
402
  Cookies.set('wc_author_email', email);
403
  Cookies.set('wc_author_name', name);
404
- Cookies.set('wc_author_website', $('.wc_website', wcForm).val());
 
 
405
  } else {
406
  storeCommenterData = parseInt(storeCommenterData);
407
  Cookies.set('wc_author_email', email, {expires: storeCommenterData, path: '/'});
408
  Cookies.set('wc_author_name', name, {expires: storeCommenterData, path: '/'});
409
- Cookies.set('wc_author_website', $('.wc_website', wcForm).val(), {expires: storeCommenterData, path: '/'});
 
 
410
  }
411
  }
412
  //============================== ADD COMMENT FUNCTION ============================== //
@@ -463,6 +467,7 @@ jQuery(document).ready(function ($) {
463
  if (editCommentForm[0].checkValidity()) {
464
  var data = new FormData();
465
  data.append('action', 'saveEditedComment');
 
466
  data.append('commentId', commentID);
467
  var inputs = $(":input", editCommentForm);
468
  inputs.each(function () {
401
  if (storeCommenterData == null) {
402
  Cookies.set('wc_author_email', email);
403
  Cookies.set('wc_author_name', name);
404
+ if ($('.wc_website', wcForm).length) {
405
+ Cookies.set('wc_author_website', $('.wc_website', wcForm).val());
406
+ }
407
  } else {
408
  storeCommenterData = parseInt(storeCommenterData);
409
  Cookies.set('wc_author_email', email, {expires: storeCommenterData, path: '/'});
410
  Cookies.set('wc_author_name', name, {expires: storeCommenterData, path: '/'});
411
+ if ($('.wc_website', wcForm).length) {
412
+ Cookies.set('wc_author_website', $('.wc_website', wcForm).val(), {expires: storeCommenterData, path: '/'});
413
+ }
414
  }
415
  }
416
  //============================== ADD COMMENT FUNCTION ============================== //
467
  if (editCommentForm[0].checkValidity()) {
468
  var data = new FormData();
469
  data.append('action', 'saveEditedComment');
470
+ data.append('wpdiscuz_unique_id', uniqueID);
471
  data.append('commentId', commentID);
472
  var inputs = $(":input", editCommentForm);
473
  inputs.each(function () {
class.WpdiscuzCore.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  * Plugin Name: WordPress Comments Plugin – wpDiscuz
5
  * Description: Better comment system. Wordpress post comments and discussion plugin. Allows your visitors discuss, vote for comments and share.
6
- * Version: 4.0.13
7
  * Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
8
  * Author URI: https://gvectors.com/
9
  * Plugin URI: http://wpdiscuz.com/
@@ -95,7 +95,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
95
  add_action('admin_post_clearChildrenData', array(&$this->optimizationHelper, 'clearChildrenData'));
96
  add_action('admin_post_removeVoteData', array(&$this->optimizationHelper, 'removeVoteData'));
97
  add_action('wp_insert_comment', array(&$this->optimizationHelper, 'addCommentToTree'), 2689, 2);
98
- add_action('comment_post', array(&$this->emailHelper, 'notificationFromDashboard'), 2712, 3);
99
  add_action('transition_comment_status', array(&$this->optimizationHelper, 'statusEventHandler'), 265, 3);
100
  add_action('delete_comment', array(&$this->optimizationHelper, 'initSubComments'), 266);
101
  add_action('deleted_comment', array(&$this->optimizationHelper, 'deleteCommentFromTree'), 267);
@@ -296,8 +296,8 @@ class WpdiscuzCore implements WpDiscuzConstants {
296
  $website_url = $form->validateDefaultWebsit($current_user);
297
  }
298
 
299
- $comment_content = $this->helper->replaceCommentContentCode(stripslashes(trim($_POST['wc_comment'])));
300
- $comment_content = trim(wp_kses($comment_content, $this->helper->filterKses()));
301
  if (!$comment_content) {
302
  $messageArray['code'] = 'wc_msg_required_fields';
303
  wp_die(json_encode($messageArray));
@@ -434,21 +434,21 @@ class WpdiscuzCore implements WpDiscuzConstants {
434
  $messageArray['code'] = 1;
435
  if ($trimmedContent != $comment->comment_content) {
436
  $trimmedContent = $this->helper->replaceCommentContentCode($trimmedContent);
437
- $commentContent = wp_kses($trimmedContent, $this->helper->filterKses());
438
  $author_ip = $this->helper->getRealIPAddr();
439
  $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
440
  $commentarr = array(
441
  'comment_ID' => $commentId,
442
- 'comment_content' => apply_filters('pre_comment_content', $commentContent),
443
- 'comment_author_IP' => apply_filters('pre_comment_user_ip', $author_ip),
444
- 'comment_agent' => apply_filters('pre_comment_user_agent', $userAgent),
445
  'comment_approved' => $comment->comment_approved
446
  );
447
- wp_update_comment($commentarr);
448
  }
449
 
450
  $form->saveCommentMeta($comment->comment_ID);
451
- $commentContent = isset($commentContent) ? stripslashes($commentContent) : $trimmedContent;
452
  $commentContent = apply_filters('wpdiscuz_before_comment_text', $commentContent, $comment);
453
  if ($this->optionsSerialized->enableImageConversion) {
454
  $commentContent = $this->helper->makeClickable($commentContent);
@@ -649,7 +649,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
649
  $commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
650
  if ($commentId) {
651
  $comment = get_comment($commentId);
652
- $commentContent = wp_kses($comment->comment_content, $this->helper->filterKses());
653
  $commentContent = apply_filters('wpdiscuz_before_comment_text', $commentContent, $comment);
654
  if ($this->optionsSerialized->enableImageConversion) {
655
  $commentContent = $this->helper->makeClickable($commentContent);
@@ -767,7 +767,7 @@ class WpdiscuzCore implements WpDiscuzConstants {
767
  */
768
  public function adminPageStylesScripts() {
769
  global $typenow;
770
- $wpdiscuzPages = array(self::PAGE_SETTINGS, self::PAGE_PHRASES, self::PAGE_TOOLS, self::PAGE_ADDONS);
771
  if ((isset($_GET['page']) && in_array($_GET['page'], $wpdiscuzPages)) || ($typenow == 'wpdiscuz_form')) {
772
  wp_register_style('wpdiscuz-font-awesome', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/font-awesome-4.6.3/css/font-awesome.min.css'), null, '4.6.3');
773
  wp_enqueue_style('wpdiscuz-font-awesome');
3
  /*
4
  * Plugin Name: WordPress Comments Plugin – wpDiscuz
5
  * Description: Better comment system. Wordpress post comments and discussion plugin. Allows your visitors discuss, vote for comments and share.
6
+ * Version: 4.0.14
7
  * Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
8
  * Author URI: https://gvectors.com/
9
  * Plugin URI: http://wpdiscuz.com/
95
  add_action('admin_post_clearChildrenData', array(&$this->optimizationHelper, 'clearChildrenData'));
96
  add_action('admin_post_removeVoteData', array(&$this->optimizationHelper, 'removeVoteData'));
97
  add_action('wp_insert_comment', array(&$this->optimizationHelper, 'addCommentToTree'), 2689, 2);
98
+ add_action('comment_post', array(&$this->emailHelper, 'notificationFromDashboard'), 2712, 2);
99
  add_action('transition_comment_status', array(&$this->optimizationHelper, 'statusEventHandler'), 265, 3);
100
  add_action('delete_comment', array(&$this->optimizationHelper, 'initSubComments'), 266);
101
  add_action('deleted_comment', array(&$this->optimizationHelper, 'deleteCommentFromTree'), 267);
296
  $website_url = $form->validateDefaultWebsit($current_user);
297
  }
298
 
299
+ $comment_content = $this->helper->replaceCommentContentCode(trim($_POST['wc_comment']));
300
+ $comment_content = $this->helper->filterCommentText($comment_content);
301
  if (!$comment_content) {
302
  $messageArray['code'] = 'wc_msg_required_fields';
303
  wp_die(json_encode($messageArray));
434
  $messageArray['code'] = 1;
435
  if ($trimmedContent != $comment->comment_content) {
436
  $trimmedContent = $this->helper->replaceCommentContentCode($trimmedContent);
437
+ $commentContent = $this->helper->filterCommentText($trimmedContent);
438
  $author_ip = $this->helper->getRealIPAddr();
439
  $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
440
  $commentarr = array(
441
  'comment_ID' => $commentId,
442
+ 'comment_content' => $commentContent,
443
+ 'comment_author_IP' => $author_ip,
444
+ 'comment_agent' => $userAgent,
445
  'comment_approved' => $comment->comment_approved
446
  );
447
+ wp_update_comment(wp_slash($commentarr));
448
  }
449
 
450
  $form->saveCommentMeta($comment->comment_ID);
451
+ $commentContent = isset($commentContent) ? $commentContent : $trimmedContent;
452
  $commentContent = apply_filters('wpdiscuz_before_comment_text', $commentContent, $comment);
453
  if ($this->optionsSerialized->enableImageConversion) {
454
  $commentContent = $this->helper->makeClickable($commentContent);
649
  $commentId = isset($_POST['commentId']) ? intval($_POST['commentId']) : 0;
650
  if ($commentId) {
651
  $comment = get_comment($commentId);
652
+ $commentContent = $this->helper->filterCommentText($comment->comment_content);
653
  $commentContent = apply_filters('wpdiscuz_before_comment_text', $commentContent, $comment);
654
  if ($this->optionsSerialized->enableImageConversion) {
655
  $commentContent = $this->helper->makeClickable($commentContent);
767
  */
768
  public function adminPageStylesScripts() {
769
  global $typenow;
770
+ $wpdiscuzPages = apply_filters('wpdiscuz_admin_pages',array(self::PAGE_SETTINGS, self::PAGE_PHRASES, self::PAGE_TOOLS, self::PAGE_ADDONS));
771
  if ((isset($_GET['page']) && in_array($_GET['page'], $wpdiscuzPages)) || ($typenow == 'wpdiscuz_form')) {
772
  wp_register_style('wpdiscuz-font-awesome', plugins_url(WPDISCUZ_DIR_NAME . '/assets/third-party/font-awesome-4.6.3/css/font-awesome.min.css'), null, '4.6.3');
773
  wp_enqueue_style('wpdiscuz-font-awesome');
forms/wpdFormAttr/Form.php CHANGED
@@ -632,6 +632,9 @@ class Form {
632
  $hasForm = false;
633
  $formRelExistsInfo = '<p class="wpd-info" style="padding-top:3px;">' . __('The red marked post types are already attached to other comment form. If you set this form too, the old forms will not be used for them.', 'wpdiscuz') . '</p>';
634
  foreach ($registeredPostTypes as $typeKey => $typeValue) {
 
 
 
635
  $checked = array_key_exists($typeKey, $this->formPostTypes) ? 'checked' : '';
636
  $formRelExistsClass = '';
637
  if (!$checked && isset($formContentTypeRel[$typeKey][$lang])) {
632
  $hasForm = false;
633
  $formRelExistsInfo = '<p class="wpd-info" style="padding-top:3px;">' . __('The red marked post types are already attached to other comment form. If you set this form too, the old forms will not be used for them.', 'wpdiscuz') . '</p>';
634
  foreach ($registeredPostTypes as $typeKey => $typeValue) {
635
+ if (!post_type_supports($typeKey, 'comments')) {
636
+ continue;
637
+ }
638
  $checked = array_key_exists($typeKey, $this->formPostTypes) ? 'checked' : '';
639
  $formRelExistsClass = '';
640
  if (!$checked && isset($formContentTypeRel[$typeKey][$lang])) {
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
- === WordPress Comments Plugin - wpDiscuz ===
2
  Contributors: gVectors Team
3
- Tags: wordpress comments, ajax comments, ajax, custom form, custom fields, live update, live comments, realtime chat, chat, realtime commenting, Lazy load, Lazy load comments, mobile commenting, post comments, advanced comment, comments box, community, discussion, discuss, disqus, discuz, Disqus alternative, Livefyre alternative, Jetpack comments alternative, Facebook comments alternative, comment form, commenting, reply, comments, better comments, discussions, comment notifications, comment template, activity, comment author, comment system, redirect, comment redirect, first commenter, email commenting, social login, boost comments, native comments
4
  Requires at least: 3.8.0
5
  Tested up to: 4.8
6
- Stable tag: 4.0.13
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Wordpress Comments Plugin - wpDiscuz: AJAX powered comments, realtime comments. Designed to extend WordPress native comments. Custom comment forms and fields.
11
 
12
  == Description ==
13
 
@@ -140,9 +140,10 @@ Support Forum: https://gvectors.com/forum/
140
 
141
  == Changelog ==
142
 
143
- = 4.0.13 =
144
 
145
- Fixed Bug: CSS changes and Style issues
 
146
 
147
  IMPORTANT:
148
 
@@ -151,6 +152,10 @@ IMPORTANT:
151
  - If you use CDN and found some issue please purge it.
152
  - If your server PHP version is lower than 5.4, [please change it to hogher](https://wordpress.org/support/topic/wpdiscuz-4-requires-php-5-4-and-higher/)
153
 
 
 
 
 
154
  = 4.0.12 =
155
 
156
  * Fixed Bug: Facebook share button conflict with Social Login buttons
1
+ === Comments - wpDiscuz ===
2
  Contributors: gVectors Team
3
+ Tags: comment, comments, ajax comments, custom comment form, custom comment field
4
  Requires at least: 3.8.0
5
  Tested up to: 4.8
6
+ Stable tag: 4.0.14
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Comments - wpDiscuz: AJAX powered comments, realtime comments. Designed to extend WordPress native comments. Custom comment forms and fields.
11
 
12
  == Description ==
13
 
140
 
141
  == Changelog ==
142
 
143
+ = 4.0.14 =
144
 
145
+ * Fixed Bug: Use backslash symbol in comment textarea: '\'
146
+ * Fixed Bug: Loose custom field data on comment editing
147
 
148
  IMPORTANT:
149
 
152
  - If you use CDN and found some issue please purge it.
153
  - If your server PHP version is lower than 5.4, [please change it to hogher](https://wordpress.org/support/topic/wpdiscuz-4-requires-php-5-4-and-higher/)
154
 
155
+ = 4.0.13 =
156
+
157
+ Fixed Bug: CSS changes and Style issues
158
+
159
  = 4.0.12 =
160
 
161
  * Fixed Bug: Facebook share button conflict with Social Login buttons
templates/comment/class.WpdiscuzWalker.php CHANGED
@@ -28,11 +28,11 @@ class WpdiscuzWalker extends Walker_Comment {
28
  $uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
29
  $commentContent = $comment->comment_content;
30
  $commentWrapperClass = '';
31
- $commentContent = wp_kses($commentContent, $this->helper->filterKses());
32
  $commentContent = apply_filters('wpdiscuz_before_comment_text', $commentContent, $comment);
33
  if ($this->optionsSerialized->enableImageConversion) {
34
  $commentContent = $this->helper->makeClickable($commentContent);
35
  }
 
36
  $commentContent = apply_filters('comment_text', $commentContent, $comment, $args);
37
  $commentReadMoreLimit = $this->optionsSerialized->commentReadMoreLimit;
38
  if (strstr($commentContent, '[/spoiler]')) {
28
  $uniqueId = $comment->comment_ID . '_' . $comment->comment_parent;
29
  $commentContent = $comment->comment_content;
30
  $commentWrapperClass = '';
 
31
  $commentContent = apply_filters('wpdiscuz_before_comment_text', $commentContent, $comment);
32
  if ($this->optionsSerialized->enableImageConversion) {
33
  $commentContent = $this->helper->makeClickable($commentContent);
34
  }
35
+
36
  $commentContent = apply_filters('comment_text', $commentContent, $comment, $args);
37
  $commentReadMoreLimit = $this->optionsSerialized->commentReadMoreLimit;
38
  if (strstr($commentContent, '[/spoiler]')) {
templates/comment/comment-form.php CHANGED
@@ -96,7 +96,7 @@ if (!post_password_required($post->ID)) {
96
  ?>
97
  <div class="wpdiscuz_top_clearing"></div>
98
  <?php
99
- if ($post->comment_status == 'open') {
100
  $wpdiscuz->helper->superSocializerFix();
101
  $form = $wpdiscuz->wpdiscuzForm->getForm($post->ID);
102
  $formCustomCss = $form->getCustomCSS();
96
  ?>
97
  <div class="wpdiscuz_top_clearing"></div>
98
  <?php
99
+ if (comments_open($post)) {
100
  $wpdiscuz->helper->superSocializerFix();
101
  $form = $wpdiscuz->wpdiscuzForm->getForm($post->ID);
102
  $formCustomCss = $form->getCustomCSS();
utils/class.WpdiscuzEmailHelper.php CHANGED
@@ -181,12 +181,15 @@ class WpdiscuzEmailHelper {
181
  }
182
  }
183
 
184
- public function notificationFromDashboard($comment_ID, $comment_approved, $commentdata) {
185
  $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
186
- if ($comment_approved == 1 && $referer && (strpos($referer, 'edit-comments.php') !== false)) {
187
- $postId = $commentdata['comment_post_ID'];
188
- $email = $commentdata['comment_author_email'];
189
- $parentComment = get_comment($commentdata['comment_parent']);
 
 
 
190
  $this->notifyPostSubscribers($postId, $comment_ID, $email);
191
  if ($parentComment) {
192
  $parentCommentEmail = $parentComment->comment_author_email;
181
  }
182
  }
183
 
184
+ public function notificationFromDashboard($comment_ID, $comment_approved) {
185
  $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
186
+ $commentdata = get_comment($comment_ID);
187
+ $commentsPage = strpos($referer, 'edit-comments.php') !== false;
188
+ $postCommentsPage = (strpos($referer, 'post.php') !== false) && (strpos($referer, 'action=edit') !== false);
189
+ if ($comment_approved == 1 && ($commentsPage || $postCommentsPage) && $commentdata) {
190
+ $postId = $commentdata->comment_post_ID;
191
+ $email = $commentdata->comment_author_email;
192
+ $parentComment = get_comment($commentdata->comment_parent);
193
  $this->notifyPostSubscribers($postId, $comment_ID, $email);
194
  if ($parentComment) {
195
  $parentCommentEmail = $parentComment->comment_author_email;
utils/class.WpdiscuzHelper.php CHANGED
@@ -55,6 +55,15 @@ class WpdiscuzHelper {
55
  return apply_filters('wpdiscuz_allowedtags', $allowedtags);
56
  }
57
 
 
 
 
 
 
 
 
 
 
58
  // Set timezone
59
  // Time format is UNIX timestamp or
60
  // PHP strtotime compatible strings
@@ -303,7 +312,7 @@ class WpdiscuzHelper {
303
  ?>
304
  <div id="comments" style="width: 0;height: 0;clear: both;margin: 0;padding: 0;"></div>
305
  <div id="respond" class="comments-area">
306
- <?php } else { ?>
307
  <div id="comments" class="comments-area">
308
  <div id="respond" style="width: 0;height: 0;clear: both;margin: 0;padding: 0;"></div>
309
  <?php
55
  return apply_filters('wpdiscuz_allowedtags', $allowedtags);
56
  }
57
 
58
+ public function filterCommentText($commentContent) {
59
+ kses_remove_filters();
60
+ remove_filter( 'comment_text', 'wp_kses_post' );
61
+ if ( ! current_user_can( 'unfiltered_html' ) ) {
62
+ $commentContent = wp_kses($commentContent, $this->filterKses());
63
+ }
64
+ return $commentContent;
65
+ }
66
+
67
  // Set timezone
68
  // Time format is UNIX timestamp or
69
  // PHP strtotime compatible strings
312
  ?>
313
  <div id="comments" style="width: 0;height: 0;clear: both;margin: 0;padding: 0;"></div>
314
  <div id="respond" class="comments-area">
315
+ <?php } else { ?>
316
  <div id="comments" class="comments-area">
317
  <div id="respond" style="width: 0;height: 0;clear: both;margin: 0;padding: 0;"></div>
318
  <?php