Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14965 closed defect (bug) (invalid)

multisite global $current_site / get_current_site() is not passing site_name

Reported by: frumph's profile Frumph Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

On my subdomain install, site_name isnt being retained in the object for $current_site

object(stdClass)#11 (4) { ["id"]=>  string(1) "1" ["domain"]=>  string(10) "frumph.net" ["path"]=>  string(1) "/" ["blog_id"]=>  string(1) "1" } Notice: Undefined property: stdClass::$site_name in \wp-content\themes\easel\functions\footer-text.php on line 32 

Line 32:

			$output .= __('Hosted on','easel') . ' <a href="http://'. $current_site->domain. $current_site->path. '">'. $current_site->site_name. '</a> ';

As you can see from the var_dump the site_name is nowhere to be found.

Change History (4)

#1 @Frumph
14 years ago

A temporary fix for this is:

		$current_site = get_current_site();
		if (!isset($current_site->site_name)) {
			$site_name = ucfirst( $current_site->domain );
		} else {
			$site_name = $current_site->site_name;
		}

Which will just capitalize the first letter of the domain instead of snagging the genuine site_name from the options for the WPMS install because its just not found on the output (non-admin) side of the theme.

The ms-options finds it just fine on a subdomain, (not root domain) in the wp-admin, just the not found on the non-admin portion of the theme.

#2 @Frumph
14 years ago

Traced it to being only unavailable on domain mapped sites. Regular subdomains pass it just fine, mapped domains do not.

#3 @nacin
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Works fine except when using a domain mapping plugin, so calling this invalid.

#4 @mohanjith
13 years ago

  • Cc moha@… added

This can be fixed if you change sunrise.php like following.

Replace $current_site = $wpdb->get_row( "SELECT * from {$wpdb->site} WHERE id = '{$current_blog->site_id}' LIMIT 0,1" ); with

wpmu_current_site();

$dm_current_site = $wpdb->get_row( "SELECT * from {$wpdb->site} WHERE id = '{$current_blog->site_id}' LIMIT 0,1" );

$current_site->id = $dm_current_site->id;

Note: See TracTickets for help on using tickets.