Skip to:
Content
Pages
Categories
Search
Top
Bottom

Component slug vs root slug


  • enderandrew
    Member

    @enderandrew

    Let’s say I set my page for a bp plugin as a child page of members. This works fine for core components as I have activity and groups under members. In BP 1.5 I see you use bp_get_groups_root_slug() which in turn basically returns $bp->groups->root_slug and I’m not sure how that is being set.

    $bp->pages->FOO and $bp->FOO->root_slug are empty and I’m not sure how they are supposed to be properly assigned.

    How do I get the value of the actual page location?

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

  • modemlooper
    Moderator

    @modemlooper

    Did you look in the skeleton component? Not sure if this will work but you create a page/tab/slug attached to a root slug with something like this.

    `function bp_foo_setup_nav() {
    global $bp;

    bp_core_new_subnav_item( array(
    ‘name’ => __( ‘My Slug’, ‘buddypress’ ),
    ‘slug’ => ‘foo’,
    ‘parent_slug’ => $bp->BP_MEMBERS_SLUG->slug,
    ‘parent_url’ => $BP_MEMBERS_SLUG,
    ‘screen_function’ => ‘bp_foo_page’,
    ‘position’ => 10
    ) );

    }
    add_action( ‘bp_setup_nav’, ‘bp_foo_setup_nav’ );`


    enderandrew
    Member

    @enderandrew

    I have, and I’ve got something close to that going on. But I don’t necessarily want the plugin hard-code that it has to go under members. It should just work wherever the page is placed, as I understand is the new standard with 1.5.

    So if I assign the corresponding page as a child page of members, urls will work accordingly.


    enderandrew
    Member

    @enderandrew

    With core functionality in Buddypress, it is simple enough to just point a URL at bp_get_groups_root_slug() plus whatever you want to append, and no matter where you have groups, it just works. And the example of this site is that forums is actually located in supporttopics. But for a new plugin, I’m not sure how to replicate the functionality for bp_get_FOO_root_slug()

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Component slug vs root slug’ is closed to new replies.
Skip to toolbar