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');
[Moderator Note: Code fixed. To ensure your code is usable for possible testing by others, always enclose your code in `backticks`
, or use the ‘code’ button.]
-
This reply was modified 7 years, 5 months ago by
bcworkz.