The MU forums have moved to WordPress.org

Registed user can not login from root page (12 posts)

  1. meetnet21
    Member
    Posted 17 years ago #

    I have installed a muwp-1.0rc2 on my server, and i havn't use vhost. I just found the registed user can not login from /wp-login.php page. But they can login from from their blog username/wp-login.php page.
    Anyone found the same problem?

  2. donncha
    Key Master
    Posted 17 years ago #

    What error message do you get when you try to login to the main blog?

  3. meetnet21
    Member
    Posted 17 years ago #

    The page isn't redirecting properly.
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    I use firefox got this message.
    The user is sign in actually.
    That's good to visite their own blog's admin pages.

  4. meetnet21
    Member
    Posted 17 years ago #

    The problem is the user can not visite the other blog admin pages. If so, it will get that error.

  5. donncha
    Key Master
    Posted 17 years ago #

    This code is right at the end of wp-admin/menu.php:

    if( $primary_blog ) {
    header( "Location: " . get_blog_option( $primary_blog, "siteurl" ) . "/wp-admin/" );
    exit;
    }

    You need to debug that by adding the following code before the header() command, but inside the if() { } condition:

    print "$primary_blog: " . get_blog_option( $primary_blog, "siteurl" )."
    ";
    die();

    This should print out enough information for you to figure out where it's trying to redirect the browser.

  6. meetnet21
    Member
    Posted 17 years ago #

    I have tried that, the result is:
    3: http://weblog.taglife.net

  7. donncha
    Key Master
    Posted 17 years ago #

    And is that the right blog for the user you were trying to login as?

  8. meetnet21
    Member
    Posted 17 years ago #

    Don't right.

    I just found the problem.
    To solve it, modify the get_blog_option function in wpmu-functions.php from:

    function get_blog_option( $id, $key, $default='na' ) {
    global $wpdb, $wpmuBaseTablePrefix, $blog_id;

    $current_blog_id = $blog_id;
    $current_options_table = $wpdb->options;
    $wpdb->options = $wpmuBaseTablePrefix . $id . "_options";
    $blog_id = $id;
    $opt = get_option( $key );
    $blog_id = $current_blog_id;
    $wpdb->options = $current_options_table;

    return $opt;
    }

    to:

    function get_blog_option( $id, $key, $default='na' ) {
    global $wpdb, $wpmuBaseTablePrefix, $blog_id, $switched;

    $current_blog_id = $blog_id;
    $current_options_table = $wpdb->options;
    $wpdb->options = $wpmuBaseTablePrefix . $id . "_options";
    $blog_id = $id;
    if ($id != $current_blog_id)
    $switched = true;
    $opt = get_option( $key );
    $blog_id = $current_blog_id;
    $wpdb->options = $current_options_table;

    return $opt;
    }

    It works now!

  9. donncha
    Key Master
    Posted 17 years ago #

    That change bypasses the WP cache when using get_option() (or get_settings()). As this has hit a few users I have added it to SVN. Thanks for reminding me of the mod!

  10. samchng
    Member
    Posted 17 years ago #

    So is "switched" suppose to be there?

  11. donncha
    Key Master
    Posted 17 years ago #

    Someone suggested it ages ago but I never saw the problem you and they were seeing and I forgot to look at it.
    The only side effect of it is a slight performance hit but since get_blog_option() isn't called for normal page views it shouldn't be too bad.

  12. dieguisherrera
    Member
    Posted 17 years ago #

    I have the same problem.

    I made the suggested changes but it still doesn't works.

    Could anybody help me please!

    Thank's

About this Topic

  • Started 17 years ago by meetnet21
  • Latest reply from dieguisherrera