Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating a root component with Skeleton Component

  • Profile photo of designodyssey
    designodyssey
    Participant

    @designodyssey

    The skeleton component creates a component that isn’t a root component in that it isn’t equivalent to groups, members, etc. What needs to be added where to accomplish this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Profile photo of designodyssey
    designodyssey
    Participant

    @designodyssey

    bump.

    Has anyone used the skeleton component to create a “root component”? I’ve looked at Classifieds, Links, but can’t figure it out for single WP.

    Profile photo of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    bp_core_add_root_component( SLUG );

    Then take a look at groups_directory_groups_setup() which catches the URL and displays the template.

    Profile photo of designodyssey
    designodyssey
    Participant

    @designodyssey

    Thanks, I’ll take a look. I tried the first part, but failed the second part.

    Profile photo of smurkas
    smurkas
    Member

    @smurkas

    Ok so I think I figured this out. I used the Skeleton component to do this and you need to change a couple of things in order for it to work. First of all, the component registers itself too late so bp_core_add_root_component() won’t work.

    Change line 45 of loader.php to
    add_action( ‘bp_include’, ‘bp_example_init’ );

    This will register the component before Buddypress sets up the URI:s and thus giving you a chance of adding your own root component.
    Then for registering my own root component I did this:
    function bp_example_setup_root_component() {
    /* Register ‘example’ as a root component */
    bp_core_add_root_component( BP_EXAMPLE_SLUG );
    }
    add_action( ‘bp_setup_root_components’, ‘bp_example_setup_root_component’ );

    Lastly you need to setup your own screen functions. Following BP:s way of doing things I created
    function bp_example_screen_example() {
    global $bp, $wpdb;
    if ( $bp->current_component != BP_EXAMPLE_SLUG )
    return false;
    die(“Example screen!”);
    }
    add_action( ‘wp’, ‘bp_example_screen_example’, 3 );

    Now that last function will catch everything that arrives on the example slug so you probably want to make it more picky so to speak.

    Profile photo of vusis
    vusis
    Participant

    @vusis

    hi there guys this is pretty old i know however, i desperately need help:
    i’m using the following setup:
    wp 3.1 bp 1.2.7

    @smurkas:

    I followed all your instructions. If i change the line 45 in the loader, i get an error from my browser saying there were too many url redirects.
    If I do not change the loader code, I notice that the $bp->current_ation variable is empty :(

    Please help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Creating a root component with Skeleton Component’ is closed to new replies.
Skip to toolbar