Skip to:

Blogs with user role “subscriber” no longer showing up in members/username/blogs list

  • lwaltzer


    Upgraded to WP 3.1.1 and BP 1.2.8 and noticed that blogs to which users are a subscriber no longer show up in their blogs list. I’m fairly certain this wasn’t the case before the upgrade. Is this a bug or a feature? And, if I wanted to change it so that those sites were included in the blogs list, how would I do so?

Viewing 3 replies - 1 through 3 (of 3 total)

  • Boone Gorges


    I’m looking at the annotated revision log I can see why Subscriber blogs aren’t showing up. What I *can’t* see is why they ever should have been. It looks to me like the code has always intended for Subscriber blogs to be excluded. A recent change in WP blog role management must have made the code finally fulfill its intended purpose.

    How to fix: You could write a short plugin that runs every time add_user_to_blog fires, and adds the blog to the BP user’s list using bp_blogs_record_blog(). Ideally there would be a more configurable way to make this work; it’s worth an enhancement ticket on trac.

    The short plugin would work something like this. Totally untested.
    `function bbg_add_subscriber_to_blog( $user_id, $role, $blog_id = false ) {
    global $current_blog;

    if ( empty( $blog_id ) )
    $blog_id = $current_blog->blog_id;

    if ( $role == ‘subscriber’ )
    bp_blogs_record_blog( $blog_id, $user_id, true );
    add_action( ‘add_user_to_blog’, ‘bbg_add_subscriber_to_blog’, 15, 3 );`

    The other part of the equation is to sync the whole shebang, which will have to be done once. Something like this (also untested) might work:
    `function bbg_record_existing_blogs() {
    global $bp, $wpdb;

    if ( !is_super_admin() )
    return false;

    /* Truncate user blogs table and re-record. */
    $wpdb->query( “TRUNCATE TABLE {$bp->blogs->table_name}” );

    $blog_ids = $wpdb->get_col( $wpdb->prepare( “SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0” ) );

    if ( $blog_ids ) {
    foreach( (array)$blog_ids as $blog_id ) {
    $users = get_users_of_blog( $blog_id );

    if ( $users ) {
    foreach ( (array)$users as $user ) {
    $role = unserialize( $user->meta_value );

    bp_blogs_record_blog( $blog_id, $user->user_id, true );
    add_action( ‘admin_init’, ‘bbg_record_existing_blogs’ );`

    Be forewarned that the latter function should only be run once; comment out the add_action() after it’s done its work. And it’ll only run if the Super Admin visits a Dashboard page. And it might be resource intensive, as it will recheck blog membership for every blog on the system. Use at your own risk.



    Thank you, Boone. On a related question. When blogs are deleted by the blog owner or blog administrator in my BuddyPress site, they continue to appear on the black horizontal bar menu with the label “my blogs”. In contrast, groups disappear all together when the group /administrator owner deletes them. Same happens with forums. How do we make the system delete listed blogs when their creators decided no to have them any longer? Does this have anything to do with blog settings or configuration?

    Boone Gorges


    @momotombopuro That sounds like a bug. BP is supposed to remove those blogs from all BP listings, including the admin bar. If you’re able to reproduce this behavior, you should open a ticket at with the steps to reproduce.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Blogs with user role “subscriber” no longer showing up in members/username/blogs list’ is closed to new replies.
Skip to toolbar