[buddypress-trac] [BuddyPress] #3916: Blog not properly added when accepting invitation sent via Dashboard

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Mon Jan 9 20:56:29 UTC 2012


#3916: Blog not properly added when accepting invitation sent via Dashboard
--------------------------+-------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  1.6
Component:  Blogs         |    Version:  1.5.2
 Severity:  normal        |   Keywords:
--------------------------+-------------------
 When you invite an existing user to a blog via Dashboard > Users > Add
 New, a confirmation email is sent that goes to a URL that looks like:
 http://example.com/newbloguser/abc123/

 When that happens, the function maybe_add_existing_user_to_blog() (ms-
 functions.php) fires, and then does add_existing_user_to_blog(), etc.
 During that process, the BP blog-related functions are loaded (in
 particular, bp_blogs_add_user_to_blog(), which is hooked to
 add_user_to_blog).

 However, these function don't work in this case. It's because WP's
 maybe_add_existing_user_to_blog is hooked to init at priority 10, as is
 the BP setup routine. In this case, it appears that WP is winning the tie,
 with the result that when the BP function fire, the Blogs component has
 not been set up. (The main symptom is that, with WP_DEBUG enabled, you see
 that the blogs database tables, $bp->blogs->table_name etc, are not
 defined.) As a result, the add-user-to-blog BP functions fail to run
 correctly.

 Not sure how to fix this. On a single site, it's easy: in an mu-plugin
 (which is loaded nice and early), do something like this:

 {{{
 remove_action( 'init', 'maybe_add_existing_user_to_blog' );
 add_action( 'init', 'maybe_add_existing_user_to_blog', 90 );
 }}}

 That ensures that BP will be loaded by the time WP attempts to run
 add_user_to_blog(). We could do something similar in the global scope of
 the BP Blogs component (but not in the component loader, which is
 initiated at bp_init->init:10), but it seems hackish, and may interfere
 with other plugins. Other ideas?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3916>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list