The MU forums have moved to WordPress.org

Register to a default blog when signup (5 posts)

  1. YannCo
    Member
    Posted 5 years ago #

    Hello,

    Sorry for my english.

    I want that when a user signup, for create a new blog or juste have account, he is included to in a default blog.

    I have my site whith this blogs and page
    subdomain blogs for users
    subdomain blog for communauty, and i want tjat all new user can create post in this blog.

    How can i do that, i look some fil like rstration.phpp or wp-signup.php but i don't see where i can do it.

  2. DeannaS
    Member
    Posted 5 years ago #

    Wouldn't be hard - take a look at the wpmu_create_user function. There's a hook in there that you can use to write a plugin that will fire when new user is created. Here's the relevant code from wpmu_functions.php.


    // Newly created users have no roles or caps until they are added to a blog.
    update_user_option($user_id, 'capabilities', '');
    update_user_option($user_id, 'user_level', '');

    do_action( 'wpmu_new_user', $user_id );

  3. YannCo
    Member
    Posted 5 years ago #

    Great thanks, very easy :p

    just add

    update_user_option($user_id, 'wp_XX_capabilities', 'a:1:{s:6:"author";b:1;}');
    update_user_option($user_id, 'wp_XX_user_level', '2');

    Replace XX by the ID of the blog !

    Thanks

  4. YannCo
    Member
    Posted 5 years ago #

    Arf, no !

    It's not good ! :(

    The solution :

    Add

    add_user_to_blog( XX, $user_id, 'author' );

    XX = blog id !

  5. TACD
    Member
    Posted 5 years ago #

    I got it working! But is there any way to then make this new blog membership the default? I tried using 'remove_user_from_blog($user_id, XX, YY)' but it didn't seem to work... any ideas?

About this Topic