[solved] removing comments still leaves a count of them?
[solved] removing comments still leaves a count of them?
i've been testing the comments module and love it! just one thing, i've also added a counter and it works great also but with all the testing i've made a lot of comments, when i delete them they still show up in the count even if i delete every comment made on that page or just delete every comment ever made they still show up in the count and if i add another it goes up by one, where is it storing this information so i can get some pages w/o a count if the comments have been deleted. client may find the need to delete a comment oh you know like something offensive(?sp) any ideas out there?
mark
mark
Last edited by Anonymous on Sat Feb 02, 2008 5:35 pm, edited 1 time in total.
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: removing comments still leaves a count of them?
If you're using the count_news_comments tag I wrote:
http://forum.cmsmadesimple.org/index.ph ... l#msg24827
then I can't seem to reproduce your problem.
What is the code you are using to count comments?
http://forum.cmsmadesimple.org/index.ph ... l#msg24827
then I can't seem to reproduce your problem.
What is the code you are using to count comments?
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: removing comments still leaves a count of them?
yep same one..
i can't reset it to 0 deleting the comments just leaves it with no comments but the count still shows how ever many were there b4,
i know it works right bcuz if you add another comment the count goes up 1...
mark
i can't reset it to 0 deleting the comments just leaves it with no comments but the count still shows how ever many were there b4,
i know it works right bcuz if you add another comment the count goes up 1...
mark
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: removing comments still leaves a count of them?
I don't know what's wrong. I've tested it and it works fine for me. Whenever I delete or disable a comment the count goes down.
This is the code I am using:
This is the code I am using:
global $gCms;
$db = &$gCms->db;
// First we get the total number of visits ever
$q = "SELECT * FROM ".cms_db_prefix()."module_comments WHERE page_id =".$params['thenewsid']." AND module_name='News' AND active='1'";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
$num_rows = $dbresult->RecordCount();
echo $num_rows;
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: removing comments still leaves a count of them?
this is what you said to use... so that's what i've been using.V... didn't know that." AND module_name='News' AND active='1'" this might make a diff...
For a regular page something like this should work:
Code:
global $gCms;
$db = &$gCms->db;
// Get number of comments
$q = "SELECT * FROM ".cms_db_prefix()."module_comments WHERE page_id =".$params['thenewsid'];
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
$num_rows = $dbresult->RecordCount();
echo $num_rows;
mark
For a regular page something like this should work:
Code:
global $gCms;
$db = &$gCms->db;
// Get number of comments
$q = "SELECT * FROM ".cms_db_prefix()."module_comments WHERE page_id =".$params['thenewsid'];
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
$num_rows = $dbresult->RecordCount();
echo $num_rows;
mark
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: removing comments still leaves a count of them?
That's only needed if this is counting comments in the news module. If you're counting comments on a page put the following in a userdefind tag named "count_page_comments":mark wrote: this is what you said to use... so that's what i've been using.V... didn't know that." AND module_name='News' AND active='1'" this might make a diff...
Then in your page template put this:mark wrote: global $gCms;
$db = &$gCms->db;
// Get number of comments
$q = "SELECT * FROM ".cms_db_prefix()."module_comments WHERE page_id =".$params['thenewsid'];
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
$num_rows = $dbresult->RecordCount();
echo $num_rows;
Code: Select all
Number of comments: {count_page_comments thenewsid=$content_id}
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: removing comments still leaves a count of them?
Hello Elijah
is there any way to make this cycle thru a list to check which module it's counting for....
ge_id =".$params['thenewsid']." AND{ if module_name='News' AND active='1'}{ else if module_name='Blog' AND active='1'}{ else if module_name='Album' AND active='1'}{/if}";
i'm no programmer but hope you get the idea.....
mark
is there any way to make this cycle thru a list to check which module it's counting for....
ge_id =".$params['thenewsid']." AND{ if module_name='News' AND active='1'}{ else if module_name='Blog' AND active='1'}{ else if module_name='Album' AND active='1'}{/if}";
i'm no programmer but hope you get the idea.....
mark
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
Re: removing comments still leaves a count of them?
I don't really understand what you mean. What exactly are you trying to do?mark wrote: Hello Elijah
is there any way to make this cycle thru a list to check which module it's counting for....
ge_id =".$params['thenewsid']." AND{ if module_name='News' AND active='1'}{ else if module_name='Blog' AND active='1'}{ else if module_name='Album' AND active='1'}{/if}";
i'm no programmer but hope you get the idea.....
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: removing comments still leaves a count of them?
your original code said...
module_comments WHERE page_id =".$params['thenewsid']." AND module_name='News' AND active='1'";
but i use the generic code...
module_comments WHERE page_id =".$params['thenewsid']; $dbresult = $db->Execute( $q );
if i use the, upper first code, count in comments and use comments in more than the News module like the first code it won't count the comments for any other module, BLog, Album pictures, so i was hoping there was some way for it to check which module it is counting for...
i've deleted some test comments and it still shows the count of them ie. i've had 7 comments on one Blog and now that i deleted some it still says 7 if you clik Add a Comment you can see there is only 2 left, it's like ghost comments are being counted...
goto this page http://www.multiintech.com/index.php?page=blogger and you see a count of comments second one down says [4] last one says [2] but each one has 1 less than it says because i've deleted some, one from each, there was an article/blog post that had 7 comments at one time to test it and i deleted them all and it still said 7
like i said i use the count tag in the comments module template and comments are used for News and Blog so the generic code was used or if i tried to say News it wouldn't count in the Blog module ok this starting to ramble.. not sure how to make it any more clear...
was hoping it could be made to check which Module it was counting for, as i am using the tag inside the comment template as in...
{$addcomment}[ {count theid=$entry->id} ]
module_comments WHERE page_id =".$params['thenewsid']." AND module_name='News' AND active='1'";
but i use the generic code...
module_comments WHERE page_id =".$params['thenewsid']; $dbresult = $db->Execute( $q );
if i use the, upper first code, count in comments and use comments in more than the News module like the first code it won't count the comments for any other module, BLog, Album pictures, so i was hoping there was some way for it to check which module it is counting for...
i've deleted some test comments and it still shows the count of them ie. i've had 7 comments on one Blog and now that i deleted some it still says 7 if you clik Add a Comment you can see there is only 2 left, it's like ghost comments are being counted...
goto this page http://www.multiintech.com/index.php?page=blogger and you see a count of comments second one down says [4] last one says [2] but each one has 1 less than it says because i've deleted some, one from each, there was an article/blog post that had 7 comments at one time to test it and i deleted them all and it still said 7
like i said i use the count tag in the comments module template and comments are used for News and Blog so the generic code was used or if i tried to say News it wouldn't count in the Blog module ok this starting to ramble.. not sure how to make it any more clear...
was hoping it could be made to check which Module it was counting for, as i am using the tag inside the comment template as in...
{$addcomment}[ {count theid=$entry->id} ]
Re: removing comments still leaves a count of them?
is there a way to inject this in for Calendar? I get a DB Error....
Re: [solved] removing comments still leaves a count of them?
How are you implementing it?
Re: [solved] removing comments still leaves a count of them?
good question 
I tried the "generic" (page) one & the "News" model.
I am not sure what the "calendar" model would be, and tested several, and none worked!

I tried the "generic" (page) one & the "News" model.
I am not sure what the "calendar" model would be, and tested several, and none worked!
