WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#12736 closed defect (bug) (fixed)

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

Reported by: 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 4 years ago.
Makes ms and my sites use get_admin_url and get_home_url

Download all attachments as: .zip

Change History (22)

comment:1 andreasnrb4 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;
    

comment:2 andreasnrb4 years ago

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

comment:3 andreasnrb4 years ago

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

comment:4 ryan4 years ago

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

comment:5 follow-up: ryan4 years ago

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

comment:6 in reply to: ↑ 5 ; follow-up: andreasnrb4 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.

comment:7 in reply to: ↑ 6 andreasnrb4 years ago

Replying to andreasnrb:
Correct ticket is #12735

comment:8 wpmuguru4 years ago

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

comment:9 ryan4 years ago

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

comment:10 ryan4 years ago

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

andreasnrb4 years ago

Makes ms and my sites use get_admin_url and get_home_url

comment:11 ryan4 years ago

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

comment:12 wpmuguru4 years ago

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

comment:13 wpmuguru4 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).

comment:14 automattor4 years ago

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

comment:15 automattor4 years ago

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

comment:16 wpmuguru4 years ago

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

comment:17 follow-up: markmcwilliams4 years ago

  • Keywords my-sites.php removed

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

comment:18 dd324 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

comment:19 dd324 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Wrong ticket. See #12763

comment:20 in reply to: ↑ 17 ocean904 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)

comment:21 ryan4 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.