• I have a function that create a new blog and adds a user as an author to that blog. The add_user_to_blog function is not adding the new user to the blog and not giving the author role. any suggestions?

    include_once(ABSPATH . 'wp-admin/includes/admin.php');
    
    $user_name = 'furball';
    $password = 'password';
    $email = 'furball@gmail.com';
    
    $user_id = wpmu_create_user($user_name, $password, $email);
    
    $domain = 'localhost';
    $path = '/multisite/hello/';
    $title = 'Hello World';
    $admin_user_id = 1;
    
    $blog_id = wpmu_create_blog($domain, $path, $title, $admin_user_id, $meta = '', $site_id = 1);
    
    $role = 'author';
    
    $result = add_user_to_blog($blog_id, $user_id, $role);
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘add_user_to_blog not working’ is closed to new replies.