Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activating the Site Tracking component

  • @turnpiece

    Participant

    Installing Buddypress on a existing WordPress site with a large number of users I’ve found that on activating the Site Tracking component I get the white screen of death. The front end of the site still works, mostly, but it’s completely killed the back end. Fortunately I’m doing this on a test site, with BP 2.2.3.1 & WP 4.2.2, and have tried with no other plugins installed and the 2015 theme. This is a single site, not multisite.

    I’ve traced this back to the bp_blogs_record_existing_blogs function, specifically

    $users = get_users( array(
    ‘blog_id’ => $blog_id
    ) );

    OK, so it can’t cope with the number of users and I guess a more powerful server with higher memory and script execution times etc. might be able to cope, but I don’t have that at the moment and I’m looking for a work around. Is there a hook or filter I can remove that’ll let me replace bp_blogs_record_existing_blogs with my own function that could go through the users in chunks, maybe using wp_cron? It’s called from within bp_core_activation_notice which is called from the bp_admin_init hook so maybe that’s the one to replace?

    If anyone has come up against this problem before and has a solution please let me know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @shanebp

    Moderator

    How many members do you have?

    Since you’re not on multisite, you could do this in function bp_blogs_record_existing_blogs:
    $users = get_users( 'fields=ID' );

    It will return an array of IDs, instead of an array of user objects so it will be faster.

    Then change the loop to this…

    foreach ( $users as $id ) {
      bp_blogs_add_user_to_blog( $id, false, $blog_id );
    }

    Yes, it requires hacking core files, but the hack is only temporary, correct?

    @turnpiece

    Participant

    Thanks. We have over 40,000 users and the test server still can’t cope with getting all the user ids. Perhaps a direct database query would do it? I’ve been trying to write a plugin using scheduled events, dealing with the users 1000 at a time, but it’s not working yet.

    @shanebp

    Moderator

    I’d var_dump the first 1000 ids and then hardcode the array into a function that loops thru the array and calls bp_blogs_add_user_to_blog – just to see if it fails.

    If it does, then something else is going on.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Activating the Site Tracking component’ is closed to new replies.
Skip to toolbar