-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn off comment subscriptions on specific custom post types #149
Comments
@jaswsinc Correct me if I'm wrong, but I don't believe there's currently a way to do this, correct? I was looking for a filter that we could hook into to hide the subscription options for certain post types, but I wasn't able to find any. Do you agree that adding the following filter to this function would be a good idea? if(apply_filters(__NAMESPACE__.'_disable_subscription_options', FALSE))
return; // Disabled by filter In the longer-term, I do agree with @bonest that we should have a way of disabling Comment Subscriptions for certain Post Types, as Comment Subscriptions won't be applicable for many Custom Post Types. |
@bonest You can do this by editing the template file in advanced mode. See: Dashboard → Comment Mail → Site Templates Referencing: https://codex.wordpress.org/Function_Reference/get_post_type |
Yes, I agree! |
@jaswsinc My feeling is that Comment Mail should only be showing Comment Subscriptions on |
Hmm. Well, I'm not sure. This actually comes as a surprise to me. I didn't realize there were a lot of plugins that used WordPress comments in a way that would make coupling them with subscriptions undesirable. If a particular type of Post is configured to use comments, then Comment Mail will be enabled along with the comments. If comments are not used, then they will not be; i.e., Comment Mail rides on comments in WordPress core.
I don't really have any problem with this. However, it seems to me that if I have a Post Type that uses comments then I would expect Comment Mail to be enabled there without any further configuration. So disabling them for anything other than the |
That seems to assume that any Custom Post Types that allow comments are designed for the same type of comments as Posts (i.e., discussion), which in my mind seems rather unlikely. Think about what scenarios you would create a Custom Post Type that supports comments: The example that @bonest gave us above is a good one. A CPT that allows comments (i.e., makes use of the WordPress comment system) to create a "reviews" section that allows visitors to leave short reviews for a Product CPT. In that scenario, having a full-fledged comment subscription system makes no sense at all. Likewise, I can't imagine many reasons a CPT would use comments and also expect something like Comment Mail to enable comment subscriptions on it. The only place Comment Subscriptions makes sense is on Posts where discussions take place. There may be some CPTs that use Comments for something that falls into the category of "discussions", but I'm willing to bet that most implementations do not. |
Great points. Thank you. I'm fine with them being enabled for |
Cool. :-) So we should add a new option in Comment Mail → Config. Options → Comment Form towards the bottom called Enable Comment Form for Custom Post Types (Comma-Delimited) that allows supplying a comma-delimited list of CPTs (just like Comment Mail → Config. Options → Auto-Subscribe Settings → Auto-Subscribe Post Types (Comma-Delimited)) and the field should include only |
Thank you for including me in your discussion. I can tell by reading the communication that you understand the issue. Jason you suggested that I could remove the form in Advanced mode. But this is not quit enough, since the plugin also hooks into the comment_post action which is fired after the comment has been inserted. So even if the form is not shown, I have to be sure that comment_mail does not send notifications. I tried last night to see if I could find a way to remove the actions on specific post types that the comment_mail is triggered from. comment_form_must_log_in_after But I did not manage to get it to work, so I am hoping for a quick fix from you guys. Kind Regards Henrik
|
@bonest If the markup is not there, the actions will not fire, because the form data that triggers Comment Mail will not be there. So if you exclude the Comment Form additions presented by Comment Mail, that should fix you up in the short term. |
By "exclude", I mean #149 (comment) |
Hi guys. I tried to remove filters, because I would like to avoid switching to advanced template. Because I have spend hours styling and translating the simple templates. It takes time testing as you know. But I can tell that it is impossible to remove the filters, to remove the form. Do you have an ETA for when this could be fixed? |
@bonest You can modify if(apply_filters(__NAMESPACE__.'_disable_subscription_options', FALSE))
return; // Disabled by filter Then you can create an MU-Plugin (create this file and directory: <?php
/*
Plugin Name: Maybe Disable Comment Mail Subscription Options
Description: Disables Comment Mail Subscription Options for certain post types
Author: WebSharks, Inc.
Version: 1.0
Author URI: http://www.websharks-inc.com
*/
add_filter('comment_mail_disable_subscription_options', '__cm_maybe_disable_sub_opts', 10, 0);
function __cm_maybe_disable_sub_opts() {
if(get_post_type() !== 'post') {
return TRUE; // Yes, disable Comment Mail Subscription Options
}
else {
return FALSE;
}
} We will be adding the above filter to |
Next Actions (Pro Version)
Next Actions (Lite Version)
|
Thanks Raam That worked perfectly. Kind Regards Henrik
|
- Enable only for default post type by default See wpsharks/comment-mail#149
Cool. That is much better. |
- Enable only for default post type by default See #149
Next Pro Release Changelog:
|
Next Lite Release Changelog:
|
Comment Mail v151224 has been released and includes changes from this GitHub Issue: See the v151224 announcement for further details. This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#149). |
Hi.
If you use Woocommerce, then Comment-mail subscription form is shown on the reviews tab.
If you use any other plugin that creates a custom post type, and uses comments you have the same problem.
I have a big issue with this, and I own a PRO license, I really need a way to disable the subscription form for comments to specific post types.
I really need a quick fix for this because I have a plugin that has to go live, that use comments, and it has its own notification system. And I have to put this plugin live today.. Tomorrow at the very latest. :-(
The text was updated successfully, but these errors were encountered: