diff --git a/README.md b/README.md index 97cfcf6..d72de56 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ **Donate link:** https://www.paypal.me/BnB90/50 **Tags:** comments, mention, email, user, bbpress **Requires at least:** 4.6 -**Tested up to:** 6.6.2 -**Stable tag:** 1.7.13 +**Tested up to:** 6.7 +**Stable tag:** 1.7.14 **Requires PHP:** 5.6 **License:** GPLv2 or later **License URI:** https://www.gnu.org/licenses/gpl-2.0.html @@ -63,6 +63,10 @@ e.g. ## Changelog ## +### 1.7.14 ### +* Mention script improvisation for pro plugin. +* Added hooks for pro plugin. + ### 1.7.13 ### * Mention script improvisation for pro plugin. diff --git a/app/main/class-bbpress-user-mention.php b/app/main/class-bbpress-user-mention.php index 3783a5b..645fc55 100644 --- a/app/main/class-bbpress-user-mention.php +++ b/app/main/class-bbpress-user-mention.php @@ -131,7 +131,7 @@ public function cmt_mntn_bbpress_mention_user_email( $post_id ) { } // Get topic content. - $topic_content = get_post_field( 'post_content', $post_id ); + $topic_content = apply_filters( 'cmt_mntn_bbp_post_content', get_post_field( 'post_content', $post_id ) ); // Prevention. if ( empty( $topic_content ) ) { diff --git a/app/main/class-comment-mention.php b/app/main/class-comment-mention.php index 2f15f78..235ee61 100644 --- a/app/main/class-comment-mention.php +++ b/app/main/class-comment-mention.php @@ -275,7 +275,7 @@ public function cmt_mntn_preprocess_comment( $comment_ID, $comment_status, $comm } // Get content. - $content = $comment_data['comment_content']; + $content = apply_filters( 'cmt_mntn_main_content', $comment_data['comment_content'], $comment_ID ); // Add data to array for post use. $comment_data['comment_ID'] = $comment_ID; diff --git a/comment-mention.php b/comment-mention.php index a1a4cc2..3dba35a 100644 --- a/comment-mention.php +++ b/comment-mention.php @@ -6,7 +6,7 @@ * Author URI: https://bhargavb.com * Text Domain: comment-mention * Domain Path: /languages - * Version: 1.7.13 + * Version: 1.7.14 * * @package Comment_Mention */ @@ -21,7 +21,7 @@ /** * The version of the plugin. */ - define( 'CMT_MNTN_VERSION', '1.7.13' ); + define( 'CMT_MNTN_VERSION', '1.7.14' ); } if ( ! defined( 'CMT_MNTN_PATH' ) ) { /** diff --git a/readme.txt b/readme.txt index 52ea30f..55c6158 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: bhargavbhandari90, biliplugins, hackkzy404 Donate link: https://www.paypal.me/BnB90/50 Tags: comments, mention, email, user, bbpress Requires at least: 4.6 -Tested up to: 6.6.2 -Stable tag: 1.7.13 +Tested up to: 6.7 +Stable tag: 1.7.14 Requires PHP: 5.6 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -63,6 +63,10 @@ e.g. == Changelog == += 1.7.14 = +* Mention script improvisation for pro plugin. +* Added hooks for pro plugin. + = 1.7.13 = * Mention script improvisation for pro plugin. diff --git a/src/js/tribute-config.js b/src/js/tribute-config.js index 1c7b7f2..b76643f 100644 --- a/src/js/tribute-config.js +++ b/src/js/tribute-config.js @@ -50,9 +50,9 @@ jQuery( }, selectTemplate: function(item) { if ( 'undefined' !== typeof( Comment_Mention.mention_by_fullname ) && '1' === Comment_Mention.mention_by_fullname ) { - return '@' + item.original.name; // Use `name` in textarea1 + return '@' + item.original.name; } else { - return '@' + item.original.key; // Use `name` in textarea1 + return '@' + item.original.key; } } } @@ -63,13 +63,35 @@ jQuery( tribute.attach( $( ".bbp-reply-form form textarea" ) ); if ( $( '#main_comment' ).length > 0 ) { - $( '#comment' ).on( 'tribute-replaced', cmt_mntn_sync_usernames ); - $( '#comment' ).on( 'input', cmt_mntn_sync_usernames ); + $( '#comment' ).on( 'tribute-replaced', function() { + cmt_mntn_sync_usernames( 'comment', 'main_comment' ); + }); + $( '#comment' ).on( 'input', function() { + cmt_mntn_sync_usernames( 'comment', 'main_comment' ); + }); } - function cmt_mntn_sync_usernames() { + if ( $( '#bbp_main_reply_content' ).length > 0 ) { + $( '#bbp_reply_content' ).on( 'tribute-replaced', function() { + cmt_mntn_sync_usernames( 'bbp_reply_content', 'bbp_main_reply_content' ); + }); + $( '#bbp_reply_content' ).on( 'input', function() { + cmt_mntn_sync_usernames( 'bbp_reply_content', 'bbp_main_reply_content' ); + }); + } + + if ( $( '#bbp_main_topic_content' ).length > 0 ) { + $( '#bbp_topic_content' ).on( 'tribute-replaced', function() { + cmt_mntn_sync_usernames( 'bbp_topic_content', 'bbp_main_topic_content' ); + }); + $( '#bbp_topic_content' ).on( 'input', function() { + cmt_mntn_sync_usernames( 'bbp_topic_content', 'bbp_main_topic_content' ); + }); + } + + function cmt_mntn_sync_usernames( default_id, main_id ) { - let content = $( '#comment' ).val(); + let content = $( '#' + default_id ).val(); let already_mentioned = localStorage.getItem('mentionMap'); @@ -88,7 +110,7 @@ jQuery( } ); - $( '#main_comment' ).val( content ); + $( '#' + main_id ).val( content ); } } );