diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php
index 006bf6f..bde6b9c 100644
|
|
function groups_total_groups_for_user( $user_id = 0 ) { |
957 | 957 | * @return BP_Groups_Group The current group object. |
958 | 958 | */ |
959 | 959 | function groups_get_current_group() { |
| 960 | global $groups_template; |
960 | 961 | $bp = buddypress(); |
| 962 | $current_group = false; |
961 | 963 | |
962 | | $current_group = isset( $bp->groups->current_group ) |
963 | | ? $bp->groups->current_group |
964 | | : false; |
| 964 | // Check the template first, in case we're in a groups loop inside of a group. |
| 965 | if ( ! empty( $groups_template->group ) && ( $groups_template->group instanceof BP_Groups_Group) ) { |
| 966 | $current_group = $groups_template->group; |
| 967 | // Next we check the bp global. |
| 968 | } elseif ( ! empty( $bp->groups->current_group ) && ( $bp->groups->current_group instanceof BP_Groups_Group ) ) { |
| 969 | $current_group = $bp->groups->current_group; |
| 970 | } |
965 | 971 | |
966 | 972 | /** |
967 | 973 | * Filters the BP_Groups_Group object corresponding to the current group. |
diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
index 2e467a4..0b5ba0d 100644
|
|
function bp_group_name( $group = false ) { |
643 | 643 | * @return string |
644 | 644 | */ |
645 | 645 | function bp_get_group_name( $group = false ) { |
646 | | global $groups_template; |
647 | 646 | |
648 | | if ( empty( $group ) ) { |
649 | | $group =& $groups_template->group; |
| 647 | if ( ! ( $group instanceof BP_Groups_Group ) ) { |
| 648 | $group = groups_get_current_group(); |
650 | 649 | } |
651 | 650 | |
652 | 651 | /** |