Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter rawi.rai

    (@rawirai-1)

    hello anyone there ??

    Hi there
    Would you please try adding the following code in your theme’s functions.php:

    function ds_one_blog_only($active_signup) {
    // get the array of the current user’s blogs
    $blogs = get_blogs_of_user( get_current_user_id() );
    // all users may be members of blog 1 so remove it from the count, could be a “Dashboard” blog as well
    if ($blogs[“1”]) unset($blogs[“1”]);
    //if the user still has blogs, disable signup else continue with existing active_signup rules at SiteAdmin->Options
    $n = count($blogs);
    if($n == 1) {
    $active_signup = ‘none’;
    echo ”;
    } elseif($n > 1) {
    $active_signup = ‘none’;
    echo ”;
    } else {
    $active_signup = $active_signup;
    }
    return $active_signup; // return “all”, “none”, “blog” or “user”
    }
    add_filter(‘wpmu_active_signup’, ‘ds_one_blog_only’);
    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.
    I hope this helps

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how do i limit per user 1 website only’ is closed to new replies.