Support » Plugin: BP Group Hierarchy » [Plugin: BP Group Hierarchy] Adding "Back"-Button to Widget Group Navigator

  • Hey there,

    i’m loving the plugin very much and i’m really comfortable with it.

    just one question:
    i would like to add a “back”-Button or -link to the Group Navigator Widget, so that you can also go one level back/up in the hierarchy – and not only down. meaning on top of the listed subgroups in the widget i would like to have a link leading one level up. in best case the link should also be called the name of the parent group, like “Back to ‘General’-Group”..

    Where do I have to do this and what code should i enter there (not yet so familiar with php and wordpress).

    Thanks a lot for your help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Any ideas or comments to this?
    Would really like to have some help with this!

    Plugin Author David Dean


    This would have to go in the bp-group-hierarchy-widgets.php file, specifically on line 150 (move the old line 150 down).

    If you want to do it right and have the name of the parent group, you will have to get an instance of the parent of the current group (if there is one), and then get a link to it and put the name in. You also need to cover when there isn’t a parent, or when you aren’t on a group page. This is a lot if you’re not familiar with PHP.

    As a shortcut, you can do something like this:

    <?php if($bp->groups->current_group) : ?>
    <a href="<?php echo trailingslashit(dirname(bp_get_group_permalink( $bp->groups->current_group ))); ?>">Up One Level</a>
    <?php endif; ?>

    This will get you a generic link to whatever is one level up. The if statement only shows the link on group pages, so you won’t see it when looking at the group list or anything.

    Hey David,
    thank you very much, this helped me a lot and is working very well!

    Just if someone should be able to write a script to show the name of the parent-group as link, i would be glad if you may post it here!

    Do this google search to find the concept of breadcrumbs as an answer:

    wordpress plugin: bp group hierarchy breadcrumbs

    Here’s the solution I found:

    I copied the code in the installation instructions in the plugin’s extension.php file to get it to appear within the ‘Member Groups’ tab section just under <div class=”group”> where it seems to be most appropriate.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: BP Group Hierarchy] Adding "Back"-Button to Widget Group Navigator’ is closed to new replies.