bp_blogs_maybe_add_user_to_blog

Rehook WP's maybe_add_existing_user_to_blog with a later priority.

Description

bp_blogs_maybe_add_user_to_blog(); 

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.


Usage

  1. if ( !function_exists( 'bp_blogs_maybe_add_user_to_blog' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_blogs_maybe_add_user_to_blog(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-blogs/bp-blogs-functions.php  
  1. function bp_blogs_maybe_add_user_to_blog() { 
  2. if ( ! is_multisite() ) 
  3. return; 
  4.  
  5. remove_action( 'init', 'maybe_add_existing_user_to_blog' ); 
  6. add_action( 'init', 'maybe_add_existing_user_to_blog', 20 );