Ticket #341 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Pages not showing on multi-site install

Reported by: Bisente Assigned to: donncha
Priority: normal Milestone: WPMU 1.0
Component: component1 Version: 2.0
Severity: normal Keywords: pages multi-site wp_site 404
Cc:

Description

Reference: http://mu.wordpress.org/forums/topic.php?id=4519

Running wpmu-1.2.1, folder-based blogs (not subdomains).

Created a secondary domain on the wp_site table. Blogs on the primary site work OK. Admin on the secondary site works ok, can create both posts and pages. When accessing a blog on the secondary site, posts show but pages don't, unless an equally-named page exists on the primary domain.

Say I have:

domain1.com/page1 domain2.com/page1 domain2.com/page2

then domain2.com/page1 works but domain2.com/page2 doesn't (404-signup page).

If I create a domain1.com/page2 page, then domain2.com/page2 starts working. If I delete domain1.com/page1, then domain2.com/page1 stops working.

Change History

(follow-up: ↓ 2 ) 05/23/07 10:27:40 changed by donncha

  • owner changed from somebody to donncha.
  • status changed from new to assigned.

The reason this happens is because wpmu-settings.php, line 116 checks blog 1 for the page. Fixing it is a bit convoluted but if you supply a patch I'll look it over and apply it.

(in reply to: ↑ 1 ) 06/03/07 19:17:09 changed by bisente

Replying to donncha:

The reason this happens is because wpmu-settings.php, line 116 checks blog 1 for the page. Fixing it is a bit convoluted but if you supply a patch I'll look it over and apply it.

I think I've fixed it. It was easy now that you've told me where to look at. :)

If I've got it right, we need to find out the blog_id for the "main" blog (directly on $prefix) on the current domain instead of hardcoding it to "1":

function is_blogname_page( $blogname ) {
        global $wpdb, $table_prefix, $domain, $path;

        $blog_data = $wpdb->get_row("SELECT blog_id FROM $wpdb->blogs WHERE domain = '$domain' AND path = '$path'");
        $blog_id = $blog_data->blog_id;

        // is the request for a page of the main blog? We need to cache this information somewhere to save a request
        $pages = $wpdb->get_col( "SELECT LOWER(post_name) FROM {$table_prefix}{$blog_id}_posts WHERE post_type='page'" );

"Works for me." Anyway I'm not familiar with WPMU internals so I may have broken something else. Please test and mark as "Fixed" if everything is OK.

(in reply to: ↑ description ) 06/16/07 16:08:07 changed by bisente

Still unfixed on version 1.2.2. My patch above works on 1.2.2 too.

(follow-up: ↓ 5 ) 06/19/07 10:41:39 changed by donncha

  • status changed from assigned to closed.
  • resolution set to fixed.

Applied this in [1001], thanks Bisente

(in reply to: ↑ 4 ) 06/20/07 09:02:32 changed by Bisente

Glad to be helpful. :)