Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: restricted page acces

Discussion in 'Misc WordPress Requests' started by benjaminsaarde, Oct 9, 2017.

  1. benjaminsaarde

    Guest

    Reply To: restricted page acces, by benjaminsaarde

    Hi,
    thanks a lot for the answers, I’ve been struggling with it for a few hours, but i just can’t make it work. The thing is that i only want people to be able to register one blog per account. I found this code on the web, but I just cant make it work, so I thought of just redirecting logged in users away from the wp-signup page. Any idea?
    The code which is not working:
    function wpms_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 > 0){
    $active_signup = ‘none’;
    echo ”;
    } else {
    $active_signup = $active_signup;
    }
    return $active_signup; // return “all”, “none”, “blog” or “user”
    }
    add_filter(‘wpmu_active_signup’, ‘wpms_one_blog_only’);

    Reply To: restricted page acces
     
    #1

Share This Page

Web Hosting