WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Networks for WordPress] Lost a child network's root Site

[Plugin: Networks for WordPress] Lost a child network's root Site

  • Hello David Dean,

    Today I have done a weird thing. There was a problem with a plugin on a child network ( Say, X.mysite.com) . So I have moved it to ‘available’ section from ‘Assigned’ . But later it disappeared from there and now I could not able to find it. I could access sub-sites(say, a.x.mysite.com) under that child network and assign new ones . But I could not find that root site and access the child network’s super admin page

    Can you please help me with that ?

    Thank you!

    http://wordpress.org/extend/plugins/networks-for-wordpress/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author David Dean

    @ddean

    Can you locate the affected site in the wp_blogs table and see what its values are?

    That would help narrow things down.

    I have already checked that . There is no sign of the child-network’s root site in wp_blogs table

    I could see the child network in wp_site

    Thank you !

    Plugin Author David Dean

    @ddean

    I had to run through the code again; it’s been so long since I’ve looked at the assignment area!

    If you moved it to “available” it should be in limbo. Check your blogs table for a blog with a site_id of 0. You should also be able to find it in the “Available” section by its name, albeit with a different network domain.

    Let me know what you find!

    If you moved it to “available” it should be in limbo. Check your blogs table for a blog with a site_id of 0.

    I have checked under wp_blogs Dean. But did n’t find it. please have a look at screen shot

    View post on imgur.com

    You should also be able to find it in the “Available” section by its name, albeit with a different network domain.

    I am aware that the blog moved to ‘available ‘ section should appear like ‘blogs.local’ . But I can’t find this child network’s root site with any name under ‘available section

    I have already moved/recovered the blogs under the affected child network to another child network. the only loss is …1) the root site and 2)lost access to super admin . There are no other problems.

    Thank you!

    Plugin Author David Dean

    @ddean

    Is blog id 29 the affected site?

    And for your 2nd question, we use this (as a mu-plugin) to access the Network Admin on networks that don’t have a root site:

    function fix_network_site_url( $url, $path, $scheme ) {
    	global $current_site, $current_blog;
    
    	if($current_blog->path != $current_site->path) {
    		if(!$current_site->blog_id) {
    			die('You need to edit ms-settings.php to ensure that a blog_id is set.');
    		}
    		$blog = get_blog_details( $current_site->blog_id, false);
    		$url = str_replace( $current_site->domain . $current_site->path, $current_site->domain . $blog->path, $url );
    	}
    	return $url;
    }
    
    add_filter( 'network_site_url', 'fix_network_site_url', 10, 3);

    Edit: forgot you also need to change wp-includes/ms-settings.php – that’s why the above hasn’t been released. After line 53:

    if ( ! isset( $current_site->blog_id ) )
    	$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s ORDER BY blog_id LIMIT 1", $current_site->domain ) );

    Is blog id 29 the affected site?

    No Sir ! It was highlighted in the screenshot, because of mouseover while taking screenshot. Actually there is no relation with blog 29 and child network

    David Dean ,

    I have created a new mu plugin with the function ” fix_network_site_url”. Used the same code with out modifying it.

    And edited the ms-settings.php file adding the code

    if ( ! isset( $current_site->blog_id ) )
    	$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s ORDER BY blog_id LIMIT 1", $current_site->domain ) );

    after

    if ( ! isset( $current_site->blog_id ) )
    		$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) );

    I find no change or result in accessing the root site’s network admin and there is no solution for lost site yet

    Hope you help me to fix this

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Networks for WordPress] Lost a child network's root Site’ is closed to new replies.