Is there a way to make all comments, trackbacks and pingbacks disabled by default when creating a new multisite blog? I know Plugin Commander allowed you to do this on old WPMu releases, but it doesn't appear to work on 3.x.
Thanks much.
Is there a way to make all comments, trackbacks and pingbacks disabled by default when creating a new multisite blog? I know Plugin Commander allowed you to do this on old WPMu releases, but it doesn't appear to work on 3.x.
Thanks much.
I'd also like help on this, but I'm wondering if I can retroactively do so. The site is already running...is there some way to go through the Network Admin dashboard to change the settings on all user blogs at once?
I found a way to do so using a MySQL database query here, http://www.lancelhoff.com/enable-or-disable-comments-on-all-posts-in-one-step/, but I can't seem to get it to work for the network install.
Thanks,
@moose - look in the repo for the "new blog defaults" plugin.
@bennet - http://wpmututorials.com/how-to/close-comments-across-the-network/
Ok, I remember seeing this one, too. Does this code just need to be a php file in the mu-plugins folder?
I got Akismet working across my entire network after reading more and more about how to hard code it in. I would like to go back and close comments on all posts, though.
Thanks for the help, Andrea.
Drop this code in the mu-plugins folder and it will close the comments on all blogs that haven’t been posted to in over 90 days, on all posts over 90 days old.
Yes :)
Ok, forgive me again.
I copied the code and uploaded a file called "comment.php" into my mu-plugins folder and got this error when I went to my page:
Parse error: syntax error, unexpected T_FUNCTION in /home2/brianbe2/public_html/student/wp-content/mu-plugins/comment.php on line 6
I removed the file, and the page loaded fine. Did I do something wrong?
Code should be...
<?php
/*
close comments globally
*/
function ra_switch_comments_off() {
global $wpdb;
$last_id = get_site_option( 'ra_comments_off', 1 );
if( $last_id < 0 )
return;
$next_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE blog_id > %d LIMIT 1", $last_id ) );
if( !$next_id ) {
update_site_option( 'ra_comments_off', -1 );
return;
}
switch_to_blog( $next_id );
if( '1' != get_option( 'close_comments_for_old_posts' ) ) {
$post = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' AND DATE_ADD(post_date, INTERVAL 8 MONTH) > NOW() LIMIT 1" );
if( empty( $post ) ) {
update_option( 'close_comments_for_old_posts', '1' );
update_option( 'close_comments_days_old', '90' );
}
}
restore_current_blog();
update_site_option( 'ra_comments_off', $next_id );
}
add_action( 'init', 'ra_switch_comments_off' );
?>You are the best. Thank you so much for the help!
All,
Thanks for all the help! And thanks to Andrea (yet again) for the link to the plugin, as well as Ipstenu for the code! This is much appreciated.
Moose
This topic has been closed to new replies.