bp_register_member_type_section()

Enable/disable profile type functionality.

Description

Source

File: bp-members/bp-members-functions.php

function bp_register_member_type_section() {

	$is_member_type_enabled = bp_member_type_enable_disable();

	if ( false === $is_member_type_enabled ) {

		// action for remove profile type metabox.
		add_action( 'bp_members_admin_user_metaboxes', 'bp_remove_member_type_metabox_globally' );

		return;
	}

	// profile types
	register_post_type(
		bp_get_member_type_post_type(),
		apply_filters( 'bp_register_member_type_post_type', array(
			'description'       => __( 'BuddyBoss profile type', 'buddyboss' ),
			'labels'            => bp_get_member_type_post_type_labels(),
			'public'            => true,
			'publicly_queryable' => bp_current_user_can( 'bp_moderate' ),
			'query_var'         => false,
			'rewrite'           => false,
			'show_in_admin_bar' => false,
			'show_in_menu' 		=> '',
			'map_meta_cap' 		=> true,
			'show_in_rest' 		=> true,
			'show_ui'           => bp_current_user_can( 'bp_moderate' ),
			'supports'          => bp_get_member_type_post_type_supports(),
		) )
	);



	// remove users of a specific profile type from members directory
	add_action( 'bp_ajax_querystring', 'bp_member_type_exclude_users_from_directory_and_searches', 999, 2 );

	// set profile type while update user profile
	//add_action( 'set_user_role', 'bp_update_user_member_type_type_set', 10, 2 );

	// fix all member count
	add_filter( 'bp_core_get_active_member_count', 'bp_fixed_all_member_type_count', 999 );

	// action for changing bp query of profile types.
	add_action( 'bp_pre_user_query',  'bp_member_type_query', 1, 1 );

	// action for remove profile type metabox.
	add_action( 'bp_members_admin_user_metaboxes', 'bp_remove_member_type_metabox' );

	//add column
	add_filter( 'manage_'. bp_get_member_type_post_type() . '_posts_columns', 'bp_member_type_add_column' );

	// action for adding a sortable column name.
	add_action( 'manage_'. bp_get_member_type_post_type() . '_posts_custom_column', 'bp_member_type_show_data' , 10, 2 );

	//sortable columns
	add_filter( 'manage_edit-' . bp_get_member_type_post_type() . '_sortable_columns', 'bp_member_type_add_sortable_columns' );

	// request filter.
	add_action( 'load-edit.php', 'bp_member_type_add_request_filter' );

	//hide quick edit link on the custom post type list screen
	add_filter( 'post_row_actions', 'bp_member_type_hide_quickedit', 10, 2 );

	// filter for adding body class where the shortcode added.
	add_filter( 'body_class', 'bp_member_type_shortcode_add_body_class' );

	// Hook for creating a profile type shortcode.
	add_shortcode( 'profile', 'bp_member_type_shortcode_callback' );

	// action for adding the js for the profile type post type.
	add_action('admin_enqueue_scripts', 'bp_member_type_changing_listing_label');

}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.