Search Results for 'disable registration'
-
AuthorSearch Results
-
March 30, 2009 at 6:26 pm #41429
In reply to: Limit users to only having one blog?
Aron Jay
Participant<?php
/*
Plugin name:Limit Blogs per User
Plugin Author:Brajesh K. Singh
Author URI:http://ThinkingInWordpress.com
Version:1.0
*/
add_filter(\”wpmu_active_signup\”,\”tiw_check_current_users_blog\”); //send fake/true enable or disabled request
add_action(\”wpmu_options\”,\”tiw_display_options_form\”); //show the form to allow how many number of blogs per user
add_action(\”update_wpmu_options\”,\”tiw_save_num_allowed_blogs\”);//action to save number of allowed blogs per user
/****Check ,whether blog registration is allowed,and how many blogs per logged in user is allowed */
function tiw_check_current_users_blog($active_signup)
{
if( !is_user_logged_in() )
return $active_signup;//if the user is not logged in,do not change the site policies
//otherwise…
global $current_user;
$blogs=get_blogs_of_user($current_user->ID);//get all blogs of user
$number_of_blogs_per_user=tiw_num_allowed_blogs();//find
//if number of allowed blog is greater than 0 and current user owns less number of blogs */
if($number_of_blogs_per_user>0&&count($blogs)<$number_of_blogs_per_user)
return $active_signup;
else
return \”none\”;
}
/****How many blogs are allowed per user *************/
function tiw_num_allowed_blogs()
{
$num_allowed_blog=get_site_option(\”tiw_allowed_blogs_per_user\”);//find how many blogs are allowed
if(!isset($num_allowed_blog))
$num_allowed_blog=0;
return $num_allowed_blog;//return the number of allowed blogs
}
/*****Show the Number of Blogs to restrict per user at the bottom of Site options ****/
function tiw_display_options_form()
{
?>
<h3><?php _e(\’Limit Blog Registrations Per User\’) ?></h3>
<table>
<tbody>
<tr valign=\”top\”>
<th scope=\”row\”>Number of blogs allowed per User</th>
<td>
<input type=\”text\” name=\”num_allowed_blogs\” value=\”<?php echo tiw_num_allowed_blogs()?>\” />
<p>If the Value is Zero, It indicates any number of blog is allowed</p>
</td>
</tr>
</tbody>
</table>
<?php
}
/**************Save the Number of blogs per user when the form is updated **************/
function tiw_save_num_allowed_blogs()
{
$allowed_number_of_blogs=intval($_POST[\”num_allowed_blogs\”]);//how many blogs the user has set
//save to the database
update_site_option(\”tiw_allowed_blogs_per_user\”,$allowed_number_of_blogs);//now update
}
?>
You can set the number of blog you would like to allow.. its not mine, just wanna share it..
– Aron
EDIT: to set the number of blogs, proceed to Site Admin/Options/ then look below..
March 12, 2009 at 9:11 pm #39867In reply to: Limit Amount of blogs a user can register
John James Jacoby
KeymasterI would do this by going into
/member-themes/buddypress-member/blogs/create.phpand doing…<?php if ( bp_blog_signup_enabled() ) : ?>
<?php
global $bp;
$blogs = bp_blogs_get_blogs_for_user($bp->loggedin_user->id);
if ($blogs['count'] != 9)
{
bp_show_blog_signup_form();
}
else
{
?>
<div id="message" class="info">
<?php _e( 'Limit nine blogs per member. If you would like another, please contact an Admin for assistance.', 'buddypress' ); ?>
</div>
<?php
}
?>
<?php else: ?>
<div id="message" class="info">
<?php _e( 'Blog registration is currently disabled', 'buddypress' ); ?>
</div>
<?php endif; ?>Just remember not to overwrite the member theme if you do a BuddyPress update.
March 5, 2009 at 2:57 pm #39313In reply to: THEME ISSUE with LDAP Plugin – Simple Question!!!!
dpsweb
MemberSORRY!!! I did this and the error went away:
WPMU Admin Options > Allow New Registrations : Disabled.
WPMU Admin LDAP Options > Disable Public Signup : NO
What happens now is when a user clicks on the signup button it takes them to the WPMU login page. They login and it uses LDAP. There is no local user account signups as everything appears to be going through the LDAP plugin to authenticate.
February 21, 2009 at 4:24 pm #38478In reply to: Only one blog for user
Burt Adsit
ParticipantOK people this seems to work. This requires modifying the member theme since I didn’t find any actions in bp to hook this into so here goes:
In the member theme the file:
/buddypress-member/blogs/create.php
There is this chunk of code:
<?php if ( bp_blog_signup_enabled() ) : ?>
..(some other stuff here)..
<?php else: ?>
<div id=”message” class=”info”>
<p><?php _e( ‘Blog registration is currently disabled’, ‘buddypress’ ); ?></p>
</div>
<?php endif; ?>
Replace the ..(some other stuff here).. with this:
<?php
global $bp;
$blogs = bp_blogs_get_blogs_for_user($bp->loggedin_user->id);
if (!$blogs)
{
bp_show_blog_signup_form();
}
else
{
?>
<div id=”message” class=”info”>
<p><?php _e( ‘Limit one Blog per member’, ‘buddypress’ ); ?></p>
</div>
<?php
}
?>
This is the entire little create.php file in pastie: http://pastie.org/396083
This was a: “quick ya we should have that and I’ve got to get to the store and get some boxes because I’m moving from Michigan where we have a snow storm today and Virginia where I’m moving to comes to a screeching halt when they get 1″ of snow and I gotta run now” solution.
When I get back from the store I’ll help clean up the damage this might cause. This does work for me in a quick test.
January 1, 2009 at 11:20 pm #35429gogoplata
ParticipantIt works for the main blog too, thought the search function isn’t all that useful given there would only be a single blog but all the other functions work with the main blog.
All you’d need to do to get this setup is to change the default role for the main blog from subscriber to contributor and disable blog registration. Also, you may want to hack at the code to remove things such as the blog directory, the list of user blogs, etc. but this is optional.
December 25, 2008 at 8:36 am #35059In reply to: Adding Admin bar only to static pages.
Burt Adsit
ParticipantThere is only an option to turn off the adminbar for logged out users. Yes/No for them. Otherwise it’s Yes for everywhere in mu. The adminbar gets generated at every page load in mu. You could disable it completely by default someplace in code and then in the pages that you want it to appear on, enable it before the wp_head() call that your theme makes in header.php
bp registers its need for attention by the calls:
add_action( ‘wp_footer’, ‘bp_core_admin_bar’ );
add_action( ‘wp_head’, ‘bp_core_add_css’ );
You could un-register these calls someplace like functions.php in your theme to turn off the adminbar globally:
remove_action( ‘wp_footer’, ‘bp_core_admin_bar’ );
remove_action( ‘wp_head’, ‘bp_core_add_css’ );
Then in your theme, on the specific pages you want to show the adminbar register the adminbar again before the call to wp_head():
add_action( ‘wp_footer’, ‘bp_core_admin_bar’ );
add_action( ‘wp_head’, ‘bp_core_add_css’ );
In your theme you’ll have to add some logic in header.php to detect what page is being displayed and make the event registration calls.
So, in functions.php un-register the calls and in header.php before wp_head() re-register them. They’ll get turned off again when functions.php loads the next time and the sequence starts again.
November 19, 2008 at 3:44 am #33823In reply to: No Blog Registration
gogoplata
ParticipantI should note, though, that the “Creat a Blog” function doesn’t work, it’s just a link to a page that says registrations are disabled.
November 19, 2008 at 3:43 am #33822In reply to: No Blog Registration
gogoplata
ParticipantRight, that’s the only downside. I only disabled it temporarily, which is why I still installed the blog component but if you never intend on allowing blogs not having it installed is probably for the best.
November 18, 2008 at 6:12 pm #33805In reply to: No Blog Registration
gogoplata
ParticipantI still installed bp-blogs, but disabled registrations and it worked perfectly.
-
AuthorSearch Results