-
-
Save imath/e3b76318fa842a905480 to your computer and use it in GitHub Desktop.
No component - Registration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* BuddyPress Custom | |
* | |
* Customize BuddyPress to only manage sign ups. | |
*/ | |
// Exit if accessed directly | |
defined( 'ABSPATH' ) || exit; | |
// Do not create a user on registration | |
define( 'BP_SIGNUPS_SKIP_USER_CREATION', true ); | |
/** | |
* Only keep core members component | |
*/ | |
function imath_restrict_default_component( $default = array() ) { | |
return array_intersect_key( array( | |
'members' => 1, | |
), $default ); | |
} | |
add_filter( 'bp_new_install_default_components', 'imath_restrict_default_component', 10, 1 ); | |
/** | |
* Disable the members component if not registration | |
*/ | |
function imath_disable_members_directory( $bool, $component = '' ) { | |
if ( 'register' != $component && 'activate' != $component ) { | |
return false; | |
} | |
return $bool; | |
} | |
add_filter( 'bp_is_current_component', 'imath_disable_members_directory', 10, 2 ); | |
/** | |
* Exclude members page from wp_list_pages | |
*/ | |
function imath_exclude_members_directory_page( $pages = array() ) { | |
$pages[] = buddypress()->pages->members->id; | |
return $pages; | |
} | |
add_filter( 'bp_core_exclude_pages', 'imath_exclude_members_directory_page', 10, 1 ); | |
/** | |
* Do 404 if trying to reach the members page | |
*/ | |
function imath_disable_buddypress_front_end() { | |
if ( is_buddypress() && ! bp_is_register_page() && ! bp_is_activation_page() ) { | |
bp_do_404(); | |
return; | |
} | |
} | |
add_action( 'bp_actions', 'imath_disable_buddypress_front_end', 1 ); | |
/** | |
* Remove Submit metabox in wp-admin/extended profile | |
*/ | |
function imath_disable_members_admin_major_metabox() { | |
remove_meta_box( 'submitdiv', get_current_screen(), 'side' ); | |
} | |
add_action( 'bp_members_admin_user_metaboxes', 'imath_disable_members_admin_major_metabox' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment