Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#12736 closed defect (bug) (fixed)

my-sites.php uses site url instead of home url in visit links

Reported by: andreasnrb's profile andreasnrb Owned by:
Milestone: 3.0 Priority: high
Severity: critical Version: 3.0
Component: Multisite Keywords: needs-patch
Focuses: Cc:

Description

wp-admin/my-sites.php uses site url instead of home url in visit links. And since home url aint easily accessible from there it cant be changed.

Attachments (1)

12736.1.patch (1.7 KB) - added by andreasnrb 14 years ago.
Makes ms and my sites use get_admin_url and get_home_url

Download all attachments as: .zip

Change History (22)

#1 @andreasnrb
14 years ago

  • Severity changed from normal to critical

This relates to tickets: #12142, #12735 and probably others.
This solves a bunch of support request related to login problems and cookies with MU.
Current fix for some of these support requests is to define new cookie paths etc but the problem is in the code.

All places that uses wrong site and home url

  • wp-admin
    • wp-includes
      • export.php
        148: if ( isset($current_site->domain) ) {  
        149: return 'http://'.$current_site->domain.$current_site->path;  
        
      • ms.php
        282: $content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);  
        333: $content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);  
        
      • upgrade.php
        201: $first_post = str_replace( "SITE_URL", esc_url("http://" . $current_site->domain . $current_site->path), $first_post );  
        232: $first_comment_url = get_site_option( 'first_comment_url', 'http://' . $current_site->domain . $current_site->path );  
        
    • ms-edit.php
      73: $dashboard_blog = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $_POST[ 'dashboard_blog' ] ) ) ) );  
      
    • ms-options.php
      62: $blogname = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $details->domain . $details->path ) ) ) );  
      87: <?php if ( get_site_option( 'admin_notice_feed' ) != 'http://' . $current_site->domain . $current_site->path . 'feed/' )  
      88: echo __( "A good one to use would be the feed from your main site: " ) . 'http://' . $current_site->domain . $current_site->path . 'feed/'; ?></td>  
      
    • ms-sites.php 737,739 should use home and site url instead
    • ms-users.php displays site url, should be home url.
      233: echo '<a href="ms-sites.php?action=editblog&amp;id=' . $val->userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';  
      
  • wp-includes
    • ms-blogs.php See #12735
    • ms-default-constants.php Numerous places
      36: ms_cookie_constants uses wrong values for paths. Will fix this #12142 and that you arent logged in on frontend when wp resides in subfolder.
      98 wp_mu_current_site should set home url and site url.
      
    • ms-functions.php
      677: $activate_url = "http://" . $current_site->domain . $current_site->path . "wp-activate.php?key=$key";  
      852: $options_site_url = esc_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");  
      883: $options_site_url = esc_url("http://{$current_site->domain}{$current_site->path}wp-admin/ms-options.php");  
      1 281: $destination = $current_site->domain . $current_site->path;
      
    • ms-load.php
      function wpmu_current_site()//messes up cookie domains due to the home, site url related faults. 
      
    • ms-settings.php
      83: $destination = "http://" . $current_site->domain . $current_site->path;  
      85: $destination = 'http://' . $current_site->domain . $current_site->path . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );  
      94: header( 'Location: http://' . $current_site->domain . $current_site->path );
      
      
  • wp-activate.php
    46: <form name="activateform" id="activateform" method="post" action="<?php echo 'http://' . $current_site->domain . $current_site->path ?>wp-activate.php">  
    67:  ... ttp://' . $current_site->domain . $current_site-> ... ttp://' . $current_site->domain . $current_site->path . 'wp-login.php?action=lostpassword');  
    69:  ... ->domain, $signup->user_login, $signup->user_email, 'http://' . $current_site->domain . $current_site->path . 'wp-login.php?action=lostpassword');  
    89: <?php if ( $url != 'http://' . $current_site->domain . $current_site->path ) : ?>  
    92:  ... e</a>.' ), 'http://' . $current_site->domain . $current_site->path . 'wp-login.php', 'http://' . $current_site->domain . $current_site->path ); ?></p>  
    
  • wp-login.php
    88:  ... ttp://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span ... 
    190: $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) ...
    196: $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "wp-login.php?action=rp&key=$key&login=" ...
    
  • wp-signup.php
    12: wp_redirect( "http://{$current_site->domain}{$current_site->path}" );  
    31: wp_redirect( "http://" . $current_site->domain . $current_site->path . "wp-signup.php" );  
    76: echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="50" /><br />';  
    78: echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="50" /><span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />';  
    83: print $current_site->domain . $current_site->path . __( 'sitename' );  
    85: print __( 'domain.' ) . $current_site->domain . $current_site->path;  
    433: $newblog = 'http://' . $current_site->domain . $current_site->path . $newblogname . '/';  
    435: $newblog = 'http://' . $newblogname . '.' . $current_site->domain . $current_site->path;
    

#2 @andreasnrb
14 years ago

ms.php 716: http://<?php echo $blog->domain.$blog->path ?> wrong

#3 @andreasnrb
14 years ago

my-sites.php 71 visit link uses siteurl should be homeurl

#4 @ryan
14 years ago

Places to do str_replace() or comparisons probably need to force the scheme to 'http' when calling home_url() and site_url().

#5 follow-up: @ryan
14 years ago

(In [13880]) network_site_url(), network_home_url(), network_admin_url(). see #12736

#6 in reply to: ↑ 5 ; follow-up: @andreasnrb
14 years ago

Replying to ryan:

(In [13880]) network_site_url(), network_home_url(), network_admin_url(). see #12736

Added a patch to #12736 which makes it easier to fix this ticket.
And makes so most of the code in [13880] can be replaced. There are bugs in that changeset as is also.

#7 in reply to: ↑ 6 @andreasnrb
14 years ago

Replying to andreasnrb:
Correct ticket is #12735

#8 @wpmuguru
14 years ago

(In [13881]) tweaks to network_*_url(), see #12736

#9 @ryan
14 years ago

(In [13882]) Don't stomp scheme arg. see #12736

#10 @ryan
14 years ago

(In [13884]) Use network_*_url(). see #12736

@andreasnrb
14 years ago

Makes ms and my sites use get_admin_url and get_home_url

#11 @ryan
14 years ago

(In [13896]) Use get_home_url() and get_admin_url(). Props andreasnrb. see #12736

#12 @wpmuguru
14 years ago

(In [13904]) block enabling network when siteurl and home are not the same, see #12736

#13 @wpmuguru
14 years ago

Missed the meetup today. So my notes are:

MU did not use the home option and did not support home option being different than the siteurl. Both MU and 3.0 multisite run fine installed in a folder but do not support offsetting the home into a folder.

For this one we should clean up the $current_site usage for 3.0 and punt the home offset support to 3.1 (particularly given the short schedule for beta & RC).

#14 @automattor
14 years ago

(In [13926]) block subdomain install when install is in a folder, see #12736

#15 @automattor
14 years ago

(In [13929]) Switch from wp_die() to a nice error message for siteurl!=home for network.php. see #12736

#16 @wpmuguru
14 years ago

(In [13930]) fix folder install detection in [13926], see #12736

#17 follow-up: @markmcwilliams
14 years ago

  • Keywords my-sites.php removed

Are we good to close, have all the issues been sorted? :)

#18 @dd32
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14216]) Correct "Last Edited by" username, Updates the last edited username upon save rather than upon a edit lock being created. Props rooodini & deepak.seth. Fixes #12736

#19 @dd32
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Wrong ticket. See #12763

#20 in reply to: ↑ 17 @ocean90
14 years ago

  • Keywords needs-patch added

Replying to markmcwilliams:

Are we good to close, have all the issues been sorted? :)

No; missing files:

  • wp-includes/ms-settings.php
  • wp-admin/includes/export.php
  • wp-admin/ms-options.php
  • wp-signup.php (#13087)

#21 @ryan
14 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

The original issue is fixed. Closing.

Note: See TracTickets for help on using tickets.