The MU forums have moved to WordPress.org

Cloned a blog in WPMU but created an infinite redirect...? Help please? (15 posts)

  1. mediafetish
    Member
    Posted 15 years ago #

    I have a situation I can't figure out and I'm hoping maybe someone can shed a bit of light before I freak out.

    It's sort of complex (at least to me) so bear with me.

    I have blog wp_1
    I have blog wp_2

    Essentially, I wanted to clone wp_1 to wp_2 - so I copied all wp_1's tables, renamed them to wp_2 and replaced the real wp_2 tables with the new ones... more or less.

    I'm aware that there are several options in the options table that I should preserve, though I'm not sure exactly which ones - a few just seemed like I should. I preserved the data in:

    siteurl
    blogname
    blogdescription
    home
    upload_path
    random_seed
    blog_public
    upload_url_path
    fileupload_url
    secret
    admin_email

    Everything seems to be going perfectly - I've essentially cloned all of the settings from wp_1 to wp_2 without losing the login details and home url, etc...

    EXCEPT!

    Now, when I try to login to the admin section of wp_2 I get an infinite redirect loop.

    Is there a field in a table I don't know about somewhere that controls where you're redirected to when you login? I'm thinking in user meta, there's a primary blog field... but I tried messing with that and can't get it working.

    Any ideas? Even a nudge would help. Thanks!

  2. mediafetish
    Member
    Posted 15 years ago #

    This is driving me nuts... ok - so what is the validation process? I've stepped through like 20 files trying to find where something's going wrong and I can't figure it out.

    I'm logged in as the site admin - but if I try to view the admin of this particular blog, I get a redirect loop. and if I change the primary blog to the blog I copied, it just sends me there. Somewhere, primary blog must be validated against something... and then if it fails, it redirects you to login or something?

    Anyone?

  3. andrea_r
    Moderator
    Posted 15 years ago #

    Soooo... you essentially made the URL of blog #2 the same as the main site.

    that's gotta cause some sort of freaky redirects right there.

  4. mediafetish
    Member
    Posted 15 years ago #

    I just used 1 as an example. I've actually got a condition in there to prevent it from doing it to wp_1 - the actual number is like 24.

  5. mediafetish
    Member
    Posted 15 years ago #

    I've done some testing and I can drop any tables I want, replace them with tables from another blog and everything works fine... except prefix->options. I went through every field in options and found anything I thought would be needed, listed above, and even with that data intact, it still gives me a weird redirect loop.

    The weird thing is that it gives me the loop even if I store all of the data, drop and recreate the table and then reinsert the data. So I'm guessing that a process somewhere updates something that I'm missing. I tried dropping all of my cookies and even just using a different browser all together... nothing.

    When logging into the admin section of blog33.mywpmu.com, what is the validation process like?

  6. jamescollins
    Member
    Posted 15 years ago #

    For each blog, there should be an option in wp_x_options with an option_name of wp_x_user_roles.

    When you copy the wp_1_options table to wp_2_options, make sure you rename the wp_1_user_rolesoption in wp_2_options to wp_2_user_roles.

    Also, in wp_usermeta, there should be a record for user_id=1 with a meta_key of wp_2_capabilities. This gives user id 1 (admin) an administrator role on blog id 2. You can check this by running this query:

    SELECT * FROM wp_usermeta WHERE user_id =1 AND meta_key LIKE '%capabilities%' ORDER BY meta_key ASC

    I hope this helps.

  7. mediafetish
    Member
    Posted 15 years ago #

    It's so funny you posted that! Thank you so much. I literally JUST figured that one out and came here to post my findings. You are absolutely correct and you win a virtual gratitude cookie.

    For those who are trying to copy an entire options table, remember the user roles field is named for the site id!

    You rule jamescollins, and thank you!

  8. jamescollins
    Member
    Posted 15 years ago #

    mediafetish,

    Glad you were able to get the problem sorted.

    Did you have to add the wp_2_capabilities meta option for user id 1 as well?

  9. mediafetish
    Member
    Posted 15 years ago #

    Looks like I'm going to be doing that after dinner - got a:

    Warning: Invalid argument supplied for foreach() in (snip)wp-includes/capabilities.php on line 31

    Still - I'm WAY closer than I was 24 hours ago. Thanks so much! I almost quit!

  10. mediafetish
    Member
    Posted 15 years ago #

    I'm confused... there already seems to be a record with the correct name but I'm getting that error... weird. Any ideas?

  11. mediafetish
    Member
    Posted 15 years ago #

    Wait... I'm onto it... I copied the user_roles field but now the value is Array rather than the serialized version... hold on, I might have it (pardon me while I talk to myself ;)

  12. mediafetish
    Member
    Posted 15 years ago #

    ah ha - I was using $wpdb->prepare and it did some voodoo to the array. Took that out and now I'm home free... I hope!

    Thanks for your help - I've been beating my head on this for a while!

  13. jamescollins
    Member
    Posted 15 years ago #

    No problems. Glad you got it working.

  14. agreda
    Member
    Posted 14 years ago #

    I encounter this same infinite redirect upon migrating from WP to WPMU. The users/usermeta tables seem to be causing my final hurdle...

    I finally got the 700+ WP users imported to the new MU site. They are unable, however, to access their dashboard. Only after signing up for a blog, or after I add a blog for them, does the loop error go away.

    I've asked about this issue here where I describe my migration issues in more detail, but is there any way to resolve this upon import instead of manually adding blogs for all users?

  15. eddihughes
    Member
    Posted 14 years ago #

    I found another way you can clone blogs, that's if you want to create a default blog template for every new blog created. I'm in the middle of testing it out but check this post out by Tabard

    http://www.morgadinho.org/2009/11/19/changing-the-default-blog-in-wordpress-mu/

About this Topic

  • Started 15 years ago by mediafetish
  • Latest reply from eddihughes