bp_blogs_maybe_add_user_to_blog()

Rehook WP’s maybe_add_existing_user_to_blog with a later priority.

Description

WordPress catches add-user-to-blog requests at init:10. In some cases, this can precede BP’s Blogs component. This function bumps the priority of the core function, so that we can be sure that the Blogs component is loaded first. See https://buddypress.trac.wordpress.org/ticket/3916.

Source

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

function bp_blogs_maybe_add_user_to_blog() {
	if ( ! is_multisite() )
		return;

	remove_action( 'init', 'maybe_add_existing_user_to_blog' );
	add_action( 'init', 'maybe_add_existing_user_to_blog', 20 );
}

Changelog

Changelog
Version Description
BuddyPress 1.6.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.