Opened 14 years ago
Closed 13 years ago
#3103 closed defect (bug) (fixed)
New blog creation in default theme – Blog URL suffix text incorrect for subdomain installation
Reported by: | bigtweet | Owned by: | |
---|---|---|---|
Milestone: | 1.5 | Priority: | minor |
Severity: | Version: | 1.2.8 | |
Component: | Blogs | Keywords: | blog creation, default theme, root blog, subdomain |
Cc: | scarter28m-temp@… |
Description
Setup
=========
WordPress 3.1, BuddyPress 1.2.8
Overview
=========
In the BuddyPress default theme, the form text associated with a new blog creation is incorrect for a subdomain installation when the root blog is changed. This problem exists both in the new user sign-up form as well as the form for creating a new blog.
As an example, if the root blog is www.mydomain.com the suffix text on both forms should end in:
http://[form input].mydomain.com
Instead what appears is:
http://[form input].www.mydomain.com
Details on network setup
==========================
I have changed my root blog to be www.mydomain.com with edits to wp-config.php using references I've found on various sites.
The following assumes that the blog id of mydomain.com is 1 and that of www.mydomain.com is 3:
define ( 'BP_ROOT_BLOG', 3 );
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL',true);
$base = '/';
define('DOMAIN_CURRENT_SITE','www.mydomain.com');
define('PATH_CURRENT_SITE','/');
define('SITE_ID_CURRENT_SITE',1);
define('BLOG_ID_CURRENT_SITE',3);
Occurences of bug
===================
On line 184 in:
wp-content/plugins/buddypress/bp-themes/bp-default/registration/register.php
http:// <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php bp_signup_blog_url_value() ?>" /> .<?php echo str_replace( 'http://', , site_url() ) ?>
On line 379 in:
wp-content/plugins/buddypress/bp-blogs/bp-blogs-templatetags.php
echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /> <span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />';
Proposed fix
=============
I have fixed this by changing site_url() with get_site_url(1) in first occurence mentioned above.
In the second occurence, I also used get_site_url(1) in my fix:
echo '<input name="blogname" type="text" id="blogname" value="'.$blogname.'" maxlength="50" /> <span class="suffix_address">.' . str_replace( 'http://', , get_site_url(1) ) . '</span><br />';
This works as long as the blog id of the initial network domain never changes from the default of 1.
Is there a better way to get the root network domain?
Thanks,
Scott
Possibly related: #3227. Needs testing against latest trunk after r4389