WordPress.org

Ready to get started?Download WordPress

Forums

Blog Copier
Privacy settings not copied correctly (3 posts)

  1. macguru
    Member
    Posted 1 year ago #

    I'm using Blog Copier to copy a template blog for new users to my system. I'm also using the More Privacy Options plugin to make the template "visible only to registered users I add to the blog" (i.e. blog_public = -1 in the wp_N_options table, where N is the blog ID).

    For some reason, the blog_public value in all my newly copied blogs is set to 1 ("Allow search engines to index this site."). The value is not being copied correctly.

    I'm not sure if there are other settings / options that are not copied correctly, but this is the only one I've noticed so far that is of critical importance to me.

    Here are the MySQL general access log entries relating to a recent blog copy copy:

    89 Query INSERT INTO wp_75_options (option_name, option_value, autoload) VALUES ..., ('blog_public', '1', 'yes'), ...
    89 Query SELECT option_value FROM wp_75_options WHERE option_name = 'blog_public' LIMIT 1
    89 Query UPDATE wp_75_options SET option_value = '1' WHERE option_name = 'blog_public'

    Any ideas how I can fix this? It used to work fine with the old wpreplicator, although that had some issues of it's own.

    http://wordpress.org/extend/plugins/blog-copier/

  2. Peter Chester
    Modern Tribe
    Plugin Author

    Posted 1 year ago #

    Excellent question!

    I see in the plugin that we have this:

    line 229:
    $to_blog_id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( "public" => 1 ), $current_site->id );

    This is setting the blog to public no matter what.

    it sounds like we need to preserve the blog public option and then restore it. I'm not sure why it's not happening but what you could do is after copying the blog, you can run the following:

    $previous_public_status = 1 or 0 depending on what the origin blog has in the 'blog_public' option.

    update_option( 'blog_public', $previous_public_status );

  3. macguru
    Member
    Posted 1 year ago #

    Thanks for the reply. I didn't notice that line of code before.
    I've just patched the code to be:

    $to_blog_id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( "public" => 0 ), $current_site->id );

    Besides needing to re-patch when updating the plugin, is there any reason not to do this?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic