Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add tab & screen function to Groups Directory


  • shanebp
    Moderator

    @shanebp

    WP 3.5, BP 1.6.2

    I see that tabs on the Groups Directory are created in bp-default/groups/index.php, so it’s easy to add a new tab as an li item.

    But what is the easiest way to point that new tab to a screen function ?
    Probably involves some ajax ?
    And / Or ?

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

  • shanebp
    Moderator

    @shanebp

    So too dumb a question ?

    Just wondering if there is an easy way than, for instance, using group extension api.


    modemlooper
    Moderator

    @modemlooper

    Group api is the proper and easy way. Once you understand it it is not too difficult.


    shanebp
    Moderator

    @shanebp

    Thx modemlooper.
    I’ve used that api many times and it’s great.
    Just being lazy. Funny how that often takes longer.


    shanebp
    Moderator

    @shanebp

    @modemlooper
    Ok, tried using the Group Extension Api.
    But it seems to only apply to single groups… ?
    Which is what this does… https://gist.github.com/4531952

    Any suggestions on how to point a li tab created in bp-default/groups/index.php to a function ?
    I hope it doesn’t involve creation of a new component.


    modemlooper
    Moderator

    @modemlooper

    Those tabs are not added with code they are written into the html /bp-default/groups/index.php

    if you want to add a tab you use this and echo html for a tab:

    `add_action( ‘bp_groups_directory_group_filter’ );`

    then you use to display a page based on the slug

    `if ( $bp->current_component == BP_GROUPS_SLUG && $bp->current_action == ‘name-of-tab’ ) {

    //create functions to show content
    add_action( ‘bp_template_title’, ‘bp_example_screen_one_title’ );
    add_action( ‘bp_template_content’, ‘bp_example_screen_one_content’ );

    //this loads a special template file to show content
    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘plugin-file-location’ ) );

    }`


    shanebp
    Moderator

    @shanebp

    Thx modemlooper, but I know all that and have used it before.

    >then you use to display a page based on the slug

    Hmmm, the whole point is not to load a new page but to use the same approach as
    All Groups and My Groups.
    So, load some content based on an ajax call – which I’ve also done before but not in this context, without using bp_core_new_subnav_item or bp_core_new_nav_item.
    I was hoping there was some way to just add a new li id and handle it from there.

    I’ll keep digging and post updates here.
    Thanks for your input.


    modemlooper
    Moderator

    @modemlooper

    I posted something in regards to this on trac. The directory is really specific in it’s content. The entire tab system is hard handed in controlling the display via javascript. The javascript only knows how to process a loop. if you add a tab and click it the js only knows how to reload the loop. There is no logic for displaying other content, yet.

    I say yet because I think it can be improved to allow non-loop content to be shown when a tab is clicked.

    stay tuned….


    shanebp
    Moderator

    @shanebp

    That would be a very handy improvement.
    I assume / hope it would apply to all theme directory index files, like /groups/, /members/

    Let me know if I can help to test or try to break a patch.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add tab & screen function to Groups Directory’ is closed to new replies.
Skip to toolbar