WordPress.org

Ready to get started?Download WordPress

Forums

Registration for Multilingual WordPress Multisite (subfolders) (14 posts)

  1. lucabarbetti
    Member
    Posted 1 year ago #

    Hello,
    sorry to bother with another question about the WordPress Multisite registration process, which has been discussed many times, but all the hints and suggestions that I have found here and in many other websites haven't worked for me or, most likerly, I haven't been able to make them work.
    The problem is that in a multilingual multisite the registration has to stay in the same language chosen by the user, it can't be redirected to the main site which is very likely in another language.
    The common proposed solution is to create a template from wp-signup.php with modified redirections (with two variants: one with .htacces modifications and the other without any change to it). I tried to apply all the snippets of code seen around, but I wasn't able to make them work.
    Could anyone, maybe the ones who have applied successfully this method, please post in a 'For Dummies' style all the required steps to accomplish this?
    Obviously every other solution will be more than welcome.
    Thank you very much!
    Best regards, Luca

  2. lucabarbetti
    Member
    Posted 1 year ago #

    Hi Mika,
    thanks a lot for your reply, I've tried your code on my test website but couldn't make it work.
    Here's what I did:

    • Created a new signup.php file;
    • Copied and pasted your code in my signup.php file;
    • Put the signup.php file in My-Theme folder;
    • Created 'registration' pages for the secondary languages and selected the the Signup template for each of them;

    When I tried to register as a french user, I was sent to localhost/fr-FR/registration, there I could fill the fields 'username' and 'email', but when I clicked on the button to submit the data I was brought back in the main site, localhost/signup, with an error 404-page not found.
    I have a multisite with subfolders, does it make any difference?
    You replaced all 'wp-signup.php' occurences with '/signup', do I have to replace 'wp-signup.php' with something different?
    Not knowing what I was exactly doing I did try to add signup.php to the root, to replace all 'wp-signup.php' with '/signup.php', to take off the '/', but none of them worked...
    Thank you again!

  3. I'm going to quote myself:

    Finally search your file for all instances of wp-signup.php and change them. To what? To whatever you’re going to name your page in the next section. I knew I wanted to name my page signup, so I replaced it with that.

    So when you did this you missed a step.

    Created 'registration' pages for the secondary languages and selected the the Signup template for each of them;

    When you made those pages, you should make sure they're ALL the same name, and replace wp-signup.php with that page's name.

    In my example, I named mine signup, so you'll see things like this:
    <form id="setupform" method="post" action="/signup">

    That' what you need to change.

  4. lucabarbetti
    Member
    Posted 1 year ago #

    Mika, thanks a lot for your help and patience!
    Ok, I think I got it, signup in /signup is the name of the registration page itself and not the name of the page template... Told you that I needed a 'dummy-proof' solution! :)
    Now I have a problem with permalinks though. That's because WordPress doesn't let me use the same slug for all those pages (i.e. if I call the italian page 'reg' the permalink becomes localhost/it_IT/reg/ and if I call the english page 'reg' the permalink becomes localhost/reg-2/, and if I tray to change it manually to localhost/reg/ WordPress reverts it to localhost/reg-2/). Maybe this is because I had to remove /blog/ from the permalink structure of the main site, otherwise the language switcher would have trouble switching language with bbPress forums.
    Also, on a lesser note, for consistency I should name each page and use a 'slug' accordingly to each language, something like: Signup, Inscripción (es), Registrazione (it), Inscription (fr), etc.... (but since this is my personal site, I could get away with one slug if only WordPress would let me use the same slug in main site and secondary sites). Unfortunately, even if WordPress Multisite is a great stepping stone for multilingual websites, maintaining language consistency is a giant pain in the butt for the less skilled ones like me.
    Do you think I can solve this permalink issue?
    Or do you think I'd be better looking for a plugin, like membership plugins or something?
    Have a good day!

  5. (i.e. if I call the italian page 'reg' the permalink becomes localhost/it_IT/reg/ and if I call the english page 'reg' the permalink becomes localhost/reg-2/, and if I tray to change it manually to localhost/reg/ WordPress reverts it to localhost/reg-2/).

    No... That would ONLY happen if you already have a page named reg in the English site, and it's in the trash.

  6. lucabarbetti
    Member
    Posted 1 year ago #

    Hi Mika,
    sure enough an old 'reg' page was in the trash. I deleted it for real and now the registration process in the proper language works BUT the following 'confirm-activate' page brings the user in the main site and, obviously, it's written in the language of the main site and this might be wrong (at least for a multilingual website of course). The user should also see the 'confirm-activate' page in her own language and stay or be brought back on the corresponding site.
    How could I solve this?
    I've looked inside wp-signup.php again, seen the function 'confirm_user_signup', but I really don't know what to do... I think I'd have a better chance with teaching my cat to read and write!

    There is also another problem: the email sent to the user, with the link to activate her registration, should be sent from the corresponding site, main or secondary depending on the language, instead it's sent from the main site therefore it's always in the language of the main site.

    On a side note, I've been reading many articles, posts and stuff regarding WordPress Multisite (building my website should have been a hobby, instead it became almost an UNPAID full time job! :)) and last night I found your interesting article ( http://halfelf.org/2011/dont-use-wordpress-multisite/ ). I wonder if you consider WordPress Multisite a good solution for a 'flawless' multilingual website. Whereas 'flawless' means that, no matter what happens underneath, on the surface the user perceives an absolut immersion in her own language, unless she decides voluntarily to switch language, of course, or to enter an area that is advertised as monolingual.

    Thanks a lot for helping me and for all the time that you give to the wordpress community. Thank you!

    Best regards,
    Luca

    N.B. I lost so many hours of sleep with this registration process that, instead of writing here, I replied to the email that wordpress.org sent me to notify me of your message... Doh! :)

  7. the following 'confirm-activate' page brings the user in the main site

    Did you also do the part where I explain how to add the user to the site? Because every time I tested, it kicked the user to the site where they'd registered.

    I wonder if you consider WordPress Multisite a good solution for a 'flawless' multilingual website.

    No, but then again, I don't consider any plugin/method to be flawless :/ MultiLanguage is a hard nut to crack.

  8. lucabarbetti
    Member
    Posted 1 year ago #

    Hi Mika,
    sorry for keeping you busy with this subject, hopefully it'll help somebody else too.
    No, I read the 'add the user' part and didn't do it because I don't neccessarly need strict per-site registration, therefore I installed the Multisite User Managment plugin.
    I wrongly thought that the registration/activation process, at least the part that is visible by the user, was done with the signup template.
    Anyway, since this morning I've been trying to do the 'add the user' part as well, but couldn't make it work, I mean, the user is always redirected to the main site, on the page that explains how to activate it.
    Basically, I created my plugin, which is only one file called per-site-registration.php, I copied it in /wp-content/plugins and finally I activated it in each secondary site.
    This file has the typical plugin 'header', your code and as many 'if' statements as my secondary sites are; it is something like this:

    /*
    plugin header
    */
    global $blog_id;
    /* add user to spanish subsite */
    if ( $blog_id == 2 ) {
      function my_activate_user( $user_id, $password, $meta )
      {add_user_to_blog( '2', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );}
      add_action( 'wpmu_activate_user', 'my_activate_user', 10, 3 );
    }
    /* add user to french subsite */
    if ( $blog_id == 3 ) {
      function my_activate_user( $user_id, $password, $meta )
      {add_user_to_blog( '3', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );}
      add_action( 'wpmu_activate_user', 'my_activate_user', 10, 3 );
    }
    etc.
    etc.

    Could you please, please, please, tell me what I did wrong?
    I deactivated even the Multisite User Management plugin, but it didn't help a bit.

    Yep, it's a hard nut to crack, for meticulous amateurs like me it even feels like a full metal nut!
    Now, I'm going off topic, but when I read pros and cons in Multilingual WordPress I thought: "Multisite, whoa, this is it!". In hindsight, I think that it has a great potential but this centralized registration mechanism simply cripples it. And, honestly, in the Multisite 'cons' list of that webpage, I think it should be clearly stated that if one needs user registration she'd better be a highly capable web programmer and have a great WordPress knowledge (or find a very kind, patient and skilled person, like Mika Epstein, who is going to help out), because adjusting it isn't trivial at all and it just goes far beyond 'more management needs'.

    Thank you so much!! :)

  9. No. Not /wp-content/plugins

    Put it in /wp-content/mu-plugins

    Then it's:

    <?php
    global $blog_id;
    
    /* add user to spanish subsite */
    if ( $blog_id == 2 ) {
      function sp_activate_user( $user_id, $password, $meta )
      {add_user_to_blog( '2', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );}
      add_action( 'wpmu_activate_user', 'sp_activate_user', 10, 3 );
    }
    /* add user to french subsite */
    if ( $blog_id == 3 ) {
      function fr_activate_user( $user_id, $password, $meta )
      {add_user_to_blog( '3', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );}
      add_action( 'wpmu_activate_user', 'fr_activate_user', 10, 3 );
    }

    The reason for this is It's always active, so no matter WHICH blog they hit, they'll be added correctly.

  10. lucabarbetti
    Member
    Posted 1 year ago #

    I created the mu-plugins folder in wp-content, corrected the plugin as you specified, moved it in mu-plugins, but after having submitted username and email the user was still kicked from localhost/fr-FR/registration/ onto localhost/registration... and I literally bit my mouse!
    Do I have to reset something? Restart something?

  11. Are you actually doing all this on Localhost?

  12. lucabarbetti
    Member
    Posted 1 year ago #

    Yep! :)
    Do you think this might be the problem?

  13. lucabarbetti
    Member
    Posted 1 year ago #

    Hi Mika,
    maybe I've found a solution with this plugin: Login With Ajax.
    I've tested it on my multisite installation and the registration seems to do what I was looking for. It's also translated in all my languages.
    Now, if only I could find a way to redirect the profile editing onto the frontend and to make disappear the admin bar, I think that, with a little widget css retouch and few more positive test results, I might be all set.
    I will let you know how it goes.
    Have a good day!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.