Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need Help: BuddyBoss Components Not Activating

  • @elearnnow

    Participant

    Hi BuddyBoss community,

    I’m having trouble activating BuddyBoss components programmatically. I’ve tried several approaches, but the components aren’t being enabled. Here’s what I’ve attempted:

    Using bp_update_option()
    Direct database updates
    Different hooks (init, after_setup_theme)
    Current Behavior:

    No components activate
    No error messages in logs
    Tried both single site and multisite
    What I Need:

    A reliable way to activate components (Groups, Activity, Messages, etc.)
    Best practices for programmatic component management
    Any known issues with automatic component activation
    <?php
    /**
    * BuddyBoss Components Activator
    * Add this to your theme’s functions.php or as a must-use plugin
    */

    // Make sure we don’t expose any info if called directly
    if (!defined(‘ABSPATH’)) {
    exit;
    }

    // Hook into after_setup_theme to ensure BuddyBoss is loaded
    add_action(‘after_setup_theme’, ‘activate_buddyboss_components_on_init’, 9999);

    function activate_buddyboss_components_on_init() {
    // Check if BuddyBoss is active
    if (!function_exists(‘buddypress’)) {
    return;
    }

    // Get current active components
    $active_components = get_option(‘bp-active-components’, array());

    // Components we want to activate
    $components = array(
    ‘groups’ => 1,
    ‘activity’ => 1,
    ‘messages’ => 1,
    ‘notifications’ => 1,
    ‘friends’ => 1,
    ‘settings’ => 1,
    ‘xprofile’ => 1,
    ‘members’ => 1
    );

    // Merge with existing components
    $new_components = array_merge($active_components, $components);

    // Only update if there are changes
    if ($active_components != $new_components) {
    update_option(‘bp-active-components’, $new_components);

    // Clear BuddyBoss component cache
    if (function_exists(‘bp_core_reset_incrementor’)) {
    bp_core_reset_incrementor(‘bp_active_components’);
    }

    // Flush rewrite rules on next load
    set_transient(‘bb_flush_rewrite_rules’, ‘1’, 60);
    }
    }

    // Handle rewrite rules flush
    add_action(‘init’, ‘bb_maybe_flush_rewrite_rules’, 9999);
    function bb_maybe_flush_rewrite_rules() {
    if (get_transient(‘bb_flush_rewrite_rules’)) {
    delete_transient(‘bb_flush_rewrite_rules’);
    flush_rewrite_rules(false);
    }
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar