Home › Forums › Comment box for SharePoint › Comment counts
- This topic has 9 replies, 2 voices, and was last updated 7 years, 2 months ago by Alexander Bautz.
-
AuthorPosts
-
-
September 8, 2017 at 04:30 #18076
When a user subscribes to new comments, it creates a record in the list with ‘ID=99:subscription’ at the end but which counts towards the comments.
So when 2 users subscribe, the posts says there are now two comments despite there being none.
Is there a way of not including them in the count?
-
September 11, 2017 at 22:31 #18125
Hi,
This was fixed in the April 19. 2017 release: https://spjsblog.com/commentbox-for-sharepoint/commentbox-change-log/Alexander
-
September 12, 2017 at 00:33 #18137
Thanks Alexander – I do have the latest version but it still doesn’t seem to be working. Do I need to refresh or reindex? Or does it only work for new ones, not the old ones?
Attachments:
-
September 12, 2017 at 02:07 #18141
I also wanted to add that I have blogmode enabled
-
September 12, 2017 at 21:09 #18154
Sorry, but I don’t understand. Does subscriptions still show in the count?
Maybe your browser have the old version of the script cashed? – hover over the “cBox by SPJS” to see the version number.
Alexander
-
September 12, 2017 at 22:46 #18158
Yes it does. I hovered over the top and it shows 2.6.3
Or perhaps it’s because of this script you’ve given me?
<a href="//ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js">//ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js</a> var cBoxCommentTicker = 100; setInterval(function(){ cBoxCommentTicker = 3000; jQuery(".ms-blog-postBox").not(".commentBox").each(function(){ jQuery(this).addClass("commentBox"); var href = jQuery(this).find("a:first").attr("href"); var id = href.substring(href.lastIndexOf("/")); getCBoxCommentCount(this,id); }); },cBoxCommentTicker); function getCBoxCommentCount(elm,id){ jQuery.ajax({ "url": _spPageContextInfo.webServerRelativeUrl+"/_api/web/lists/getbytitle('SPJS-CommentBox')/items?$filter=substringof('"+id+"',Title)", "method": "GET", "headers": { "Accept": "application/json; odata=verbose" }, "success": function (data) { jQuery(elm).find(".ms-blog-command-noLeftPadding").html(data.d.results.length+" comments"); }, "error": function (err) { // console.log(err); } }); }
-
September 14, 2017 at 19:42 #18190
Try modifying it like this:
<a href="//ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js">//ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js</a> var cBoxCommentTicker = 100; setInterval(function(){ cBoxCommentTicker = 3000; jQuery(".ms-blog-postBox").not(".commentBox").each(function(){ jQuery(this).addClass("commentBox"); var href = jQuery(this).find("a:first").attr("href"); var id = href.substring(href.lastIndexOf("/")); getCBoxCommentCount(this,id); }); },cBoxCommentTicker); function getCBoxCommentCount(elm,id){ jQuery.ajax({ "url": _spPageContextInfo.webServerRelativeUrl+"/_api/web/lists/getbytitle('SPJS-CommentBox')/items?$filter=substringof('"+id+"',Title)", "method": "GET", "headers": { "Accept": "application/json; odata=verbose" }, "success": function (data) { var count = 0; jQuery.each(data.d.results,function(i,o){ if(o.Title.match("subscription") === null){ count += 1; } }); jQuery(elm).find(".ms-blog-command-noLeftPadding").html(count+" comments"); }, "error": function (err) { // console.log(err); } }); }
-
September 15, 2017 at 02:33 #18195
Unfortunately that still shows incorrectly. I’ve tried using private mode but still the same result. Anything else I can try?
-
September 17, 2017 at 03:00 #18200
Apologies, that did work! I just renamed the file and reuploaded the new one with the same name but SP automatically re-linked all CEWP to the old file so hence didn’t reflect!
Thanks Alex!
-
September 18, 2017 at 21:21 #18204
No problem, I’m glad you got it working.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.