This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Improved Manage Comments Addon
#1

I found it was taking way too much time to delete un-wanted comments / spam.

So what I have done was add a checkbox feature so you are able to "mass delete" comments.

[Image: 332aqnr.png]

When you hit the "Delete Selected" button, a confirm dialog box will appear. As you can see in the screenshot, I've also added "Check All / Clear All" links.

The delete feature works exactly the same as if you were to delete the comment the old way - All replies attached to the comment will also be deleted.

I have extensively tested this and it works great, but with that said : ** Use at your own risk! **

Requirements
Commentics v2.3

Installation Instructions
1) Download the attached file at the bottom of this post
2) Backup your /comments/admin/includes/pages/manage_comments.php file
3) Copy the new manage_comments.php (overwriting the old file)

Feel free to let me know here if you run in to any bugs. Enjoy!


Attached Files
.php manage_comments.php Size: 11.16 KB  Downloads: 28
Reply
#2

Hi MuffinMan,

Really excellent work! I've been meaning to add this feature for a long time but there was one issue which was holding me back, and you seem to have overcome it, (whether it was on purpose or not I'm not sure). It's with the search feature. Let's say if you search and it filters the results down to a few, I was expecting that when I then clicked the 'Check All' link and hit delete it would delete all of the comments instead of just the ones that I had searched for. However it only deleted the ones that I had searched for and all of the rest were still there, which is great! Did you mean to code it like that?

There are a few suggestions that I want to make:

1. It only shows comments that are not approved. I had to change "WHERE is_approved = 0" to "WHERE is_approved = 0 OR 1" to show all of them. (The comments that I wanted to delete were approved).

2. The approve and delete buttons link to a 'moderate_comments' page which doesn't exist. I have a feeling this is linked to (1) - maybe you had created a 'moderate_comments' page which only shows comments that need approval.

3. I think the '<?=' will only work if the server has PHP short tags enabled, so it may be better to use '<?php echo' instead.

4. You can add class="button" to the button to make it look like the other ones.

5. I didn't test what happens with the 'Check All' if there are multiple pages, so not sure what would happen there?

6. Is it possible to convert the $_POST to a $_GET, so it's like the existing delete feature, or do you think $_POST is best in this case?

Have you completed the interview?
Reply
#3

Thanks for the feedback!

Quote:Really excellent work! I've been meaning to add this feature for a long time but there was one issue which was holding me back, and you seem to have overcome it, (whether it was on purpose or not I'm not sure). It's with the search feature. Let's say if you search and it filters the results down to a few, I was expecting that when I then clicked the 'Check All' link and hit delete it would delete all of the comments instead of just the ones that I had searched for. However it only deleted the ones that I had searched for and all of the rest were still there, which is great! Did you mean to code it like that?

Yes, I made it so the Check All / Clear All works for only what is currently showing on the screen. I've used that javascript code in another project and it worked great - so I decided to use it in here.

Quote:It only shows comments that are not approved. I had to change "WHERE is_approved = 0" to "WHERE is_approved = 0 OR 1" to show all of them. (The comments that I wanted to delete were approved).

Sorry about that .. I was excited to release this and forgot about that feature. What happened is I created a new admin page just for moderating comments and did not revert that setting.

Quote:The approve and delete buttons link to a 'moderate_comments' page which doesn't exist. I have a feeling this is linked to (1) - maybe you had created a 'moderate_comments' page which only shows comments that need approval.

I thought I changed that ... I guess not. Yikes.

Quote:I think the '<?=' will only work if the server has PHP short tags enabled, so it may be better to use '<?php echo' instead.

You're absolutely right - I will get that fixed.

Quote:You can add class="button" to the button to make it look like the other ones.

Ok great, I will add that to the code.

Quote:I didn't test what happens with the 'Check All' if there are multiple pages, so not sure what would happen there?

It should still work as intended, but I will double check on that.

Quote:Is it possible to convert the $_POST to a $_GET, so it's like the existing delete feature, or do you think $_POST is best in this case?

Why I tried using $_GET, it wasn't working for me. I'll look at that again today and see if I can figure out where I went wrong.
Reply
#4

I was able to get the bug fixes resolved (minus changing the $_POST to $_GET feature).

I'm not able to modify my original post, could you grab the attached file and modify my original post with this new one?

I'll try and get the last change you requested done tonight.

P.S. - I tested the "Check All " with multiple pages and it worked as intended.

Thanks.


Attached Files
.php manage_comments.php Size: 11.12 KB  Downloads: 20
Reply
#5

Keep it as $_POST, it's okay. It's probably more suitable if there can be many comments to be deleted. The URL might struggle with it.

I'll add this for the next version. I could also do a bulk Approve and Send as well.

Have you completed the interview?
Reply
#6

Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
28-Mar-2023, 12:17 PM
Last Post by noblues
26-Sep-2013, 05:44 PM
Last Post by kooler
02-Aug-2013, 05:29 PM
Last Post by Steven
27-Jan-2013, 09:31 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)