Skip to:

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7071 closed defect (bug) (wontfix)

Within groups-loop.php please provide meta as action or single filterable function.

Reported by: garrett-eclipse's profile garrett-eclipse Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.0
Component: Groups Keywords:



In the groups-loop.php for the group action meta it's handled by two separate functions; bp_group_type and bp_group_member_count. This makes it impossible to customize elegantly. Would love if could be replaced with a single action or a single function which is filterable.

Currently the group action meta;

<div class="meta">
        <?php bp_group_type(); ?> / <?php bp_group_member_count(); ?>

In my theme I replaced with a single do_action so that I could remove the member_count unless you were an administrator or it was a forum group;

<div class="meta">
        <?php do_action( 'bp_directory_groups_meta' ); ?>

And here's my action which handles this custom functionality (for reference);

// Groups Meta
add_action('bp_directory_groups_meta', array($this, 'bp_groups_meta'));
// Update Groups Meta
function bp_groups_meta() {
    global $bp, $groups_template;

    if ( ! empty( $groups_template ) ) {
        $group =& $groups_template->group;
    else {
        $group = groups_get_current_group();

    if ( current_user_can( 'manage_options' ) ) {
        echo ' / ';
    } else if ( ! empty( groups_get_groupmeta( $group->id, 'forum_id' ) ) ) {

So in my case I conditionally wanted to hide the member_count, but by using an action or filterable function others and plugin developers could customize or add to the available group action meta.

Thank you

Change History (3)

#1 @hnla
8 years ago

I may be reading this wrong, but in trying, when possible, to provide easier access to markup in templates when the rendering is locked away deep in core files, I'm not sure why parcelling these two functions into one helps that notion?

Has this not been over thought, why could the functions not be wrapped in the user_can check directly, even if not then is this not something one would perhaps build on a per site basis?

#2 @DJPaul
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

We don't want to move more template code into core functions. It might be easier for developers to tweak everyone's default template pack, but it makes it more obscure for themers to customise these parts of the template. It is of course possible when we create the new template pack, that that "theme" may have a convenience function to do something similar, but it's not something we want to change to BP-Legacy this late in its life.

I think @hnla's suggestion is along the right lines.

#3 @hnla
8 years ago

It is of course possible when we create the new template pack, that that "theme" may have a convenience function to do

There might be the possibility here of something along these lines, yet to really be hammered out but possibly we'll replace those template tags with a single one and run a new function from buddypress-functions.php with filter rather than template do_action().

I'll create a ticket on next-template-packs to point here as a reminder to think further on this.

Note: See TracTickets for help on using tickets.