Register form questions with buddypress installed

Hello,
In my WPMU network, with buddypress installed, I use the default registration form - wordpress register+buddypress register. What I want to do is
- create a subsite(blog) option is always CHECKED as default (currently it is unchecked in the registration form)
- default subdomain name is the same as username. (well, not vey important)

How to do these?

  • Rupok
    • Support Ninja

    Hi Yudong, hope you had a wonderful day.

    Well, the easier way will be using jQuery to pre-check create a subsite option. I could give you code for doing this if I could see your registration page. Can you please provide the link so we can work on that?

    About your second requirement, this is also possible with JavaScript. This StackOverflow answer can help you: http://stackoverflow.com/a/18434286

    Have a nice day. Cheers!
    Rupok

  • Ash
    • WordPress Hacker

    Hello Yudong

    Please try the following code:

    add_action( 'wp_head', function() {
        ?>
        <script type="text/javascript">
        jQuery(function($){
            $('#signup_with_blog').click();
    
            $( '#signup_blog_url' ).attr('readonly', 'readonly');
    
            $('#signup_username').keyup(function() {
                var val = $(this).val();
                $('#signup_blog_url').val(val);
            });
        });
        </script>
        <?php
    } );

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    Okay, add the following:

    <?php
    
    add_action( 'wp_head', function() {
        ?>
        <script type="text/javascript">
        jQuery(function($){
            $('#signup_with_blog').click();
    
            $( '#signup_blog_url' ).attr('readonly', 'readonly');
    
            $('#signup_username').keyup(function() {
                var val = $(this).val();
                $('#signup_blog_url').val(val);
            });
        });
        </script>
        <?php
    } );

    If the code doesn't work, keep the code in there and let me know.

    Have a good day!

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.