yongra
Member
Posted 17 years ago #
Hi All, I finally got a MU working. I had many problems with Windows 2003 server. So I switched off to Linux and it finally works.
Does anyone know how to disable "create new blog" on the main page? I would like the creation to be managed by the admin.
Thanks
simply editing the home.php file (in your theme directory) is the easiest.
I'm guessing you'd also want to remove the wp-signup.php page from your server so the spambots can't access it directly. Not sure yet if that would cause any other issues though.
yongra
Member
Posted 17 years ago #
I guess there is no setting in the options to disable this. I did not see the setting but I wanted to be sure that I did not missed it some where.
thanks
muhkayoh, is right. I forgot about it. good thing to do!
or maybe change the signup page to something else. disable it temporairy, so you can switch it on again when needed :)
To actually disable it - no as it kind of defeats the purpose of the software I would think.
The only thing I can think of is putting a non-existant domain in the 'Restrict email registrations to this domain' field in the Site Admin -> Options page but that still would mean visitors would be able to access the signup page. They would just hit a brick wall when they tried. :)
Best bet would be to delete the file like has been suggested I would think.
Here's a compromise. Keeps out new bloggers without restricting current bloggers.
Try something like the following after get_header in wp-signup.php instead of trashing it altogether.
if( is_user_logged_in() == false ) {
die( __('Sorry we are not accepting new bloggers at this time. Use the contact form to request admission. If you have an account, login and try again.') );
}
or this will turn all away but the site admin, you.
if( is_site_admin() == false ) {
die( __('You do not have permission to access this page.') );
}
I would love to see a build in 'switch' in the Site Admin tab in future versions of Wordpress MU... meanwhile I just use this:
if( is_user_logged_in() == false xor is_site_admin() == false ) {
die( __('Sorry we are not accepting new bloggers at this time. If you already have an account - but no administrator rights - you are unable to create new blogs as well.') );
}
I liek stgoos text in there better than the 'You do not have permission to access this page.' It's just nicer for the end user.
sadbuttrue
Member
Posted 17 years ago #
I second stgoos; we are looking to use Wordpress MU in education, for groups of K12 students to get into blogging. Obviously don't want users to create their own blogs, need to set them up for them and then close the site.
stgoos is actually in the wrong on this one, though. It should be a bitwise AND, not an XOR. You want BOTH conditions to be evaluated as true; in other words, if the user requesting a blog is neither admin NOR a registered user, display the message. If either condition is true (i.e., if the user is either registered or an admin), then allow them to register a blog.
I quickly whipped up this plugin to use on my site (put in /wp-content/mu-plugins/signup-restrictions.php) which does not require modification of core files:
<?php
/*
Plugin Name: Signup Restrictions
Plugin Author: Jeremy Visser
Author URI: http://jeremy.sunriseroad.net/
Description: Restricts signups on WordPress MU.
*/
function sr_check_allowed () {
if( false == is_user_logged_in() ) {
get_header();
echo '<div id="content" class="widecolumn">';
_e('Sorry, we are not accepting new bloggers. If you already have an account, <a href="wp-login.php?redirect_to=wp-signup.php">log in</a> and try again.');
echo '</div>';
get_footer();
die();
}
}
add_action('signup_header', 'sr_check_allowed');
?>
See it in action.
fo0bar
Member
Posted 17 years ago #
I needed to be able to allow users to sign up (for registered-only commenting), but did not want the public to be able to create new blogs. The plugin below does this, but it's not exactly elegant. If the user tries to register a new blog, he isn't informed this is not possible until the very last moment. Still, it works.
<?php
/*
Plugin Name: New Blog Restrictions
Plugin Author: Ryan Finnie
Author URI: http://www.finnie.org/
Description: Restricts new blog creations on WordPress MU.
*/
function nb_restrict_check() {
switch ($_POST['stage']) {
case 'validate-blog-signup':
get_header();
echo '<div id="content" class="widecolumn">';
_e('Sorry, we are not accepting new blogs. Your new username has not been created. Please go back and select "Just a username, please." instead. Thank you.');
echo '</div>';
get_footer();
die();
break;
case 'gimmeanotherblog':
get_header();
echo '<div id="content" class="widecolumn">';
_e('Sorry, we are not accepting new blogs.');
echo '</div>';
get_footer();
die();
break;
}
}
add_action('signup_header', 'nb_restrict_check');
?>
Thanks foobar, that's exactly what I was looking for. Any ideas about how to clean up the UI so people don't see an option that's not available to them?
justinleatherbury
Member
Posted 17 years ago #
That's really close to what we need Foobar. I haven't done a massive search yet, but we will be looking for a plugin that only allows signups for blogs from our domain, but will allow signups for comment accounts from all the others. Regardless, thank you!
richschmidt
Member
Posted 17 years ago #
I can't believe this isn't an option in the admin backend. You have to edit files just to keep random people from creating blogs on your setup??
Why not open up a trac ticket instead of just complaining?
The point of the software is to allow folks to open up their own blogs. That's probably why it's not a current option.
And most of us have edited the software and made many changes. It's one of the plusses of Open Source software.
tspencer
Member
Posted 16 years ago #
Thanks foobar...plugin works perfectly,
It's now an option in the backend, no need for hacking or plugins!
where is that option in the backend?
i take it that might only be an option in the new wpmu 1.3.. and i think i have a slight improvement over foobar's plugin above for everyone else who isn't upgrading:
<?php
/*
Plugin Name: Disable Blog Signups
Plugin Author: Jessica Yazbek
Author URI: http://exobi.com/
Description: Removes option to create new blogs from WPMU's wp-signup.php
*/
function disable_blog_signups ( $active_signup ) {
$active_signup = 'user';
return $active_signup;
}
add_filter ('wpmu_active_signup','disable_blog_signups');
?>
peripatetic
Member
Posted 16 years ago #
My alternative approach was to put the following lines in my .htaccess file
# Limit access to the signup page
AuthName "Restricted Blog Signup"
AuthType Basic
AuthUserFile /path/to/files/blog/.htpasswd
AuthGroupFile /dev/null
<Files wp-signup.php>
require valid-user
</Files>
and then created a .htpasswd file with a single login. This way, people who know the password can create blogs, but others cannot.
N.B. you can make the .htpasswd file on numerous htpasswd generator sites around the internet.
I've tried both the plugin codes here. When i put the plugins in the wp-content/mu-plugins directory they don't show up in my admin plugins panel.
When i put the plugins in the wp-content/plugins directory they show up in the admin plugins but trying to activate gives a fatal error.
Any ideas?
In the most recent code base, there's an option to turn off signups. No plugins needed.
Site Admin -> OPtions.
nicjohnson
Member
Posted 16 years ago #
I've seen the option of disabling new signups. Thanks.
However, I want MU to send a 404 back (that I can handle with the 404.php file in my theme) instead of redirecting to the wp-signup.php page. Is this possible?
TIA!