[buddypress-trac] [BuddyPress Trac] #7071: Within groups-loop.php please provide meta as action or single filterable function.

buddypress-trac noreply at wordpress.org
Wed May 18 01:51:02 UTC 2016


#7071: Within groups-loop.php please provide meta as action or single filterable
function.
--------------------------------+-----------------------------
 Reporter:  garrett-eclipse     |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Component - Groups  |    Version:  2.5.0
 Severity:  normal              |   Keywords:
--------------------------------+-----------------------------
 Hello,

 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;
 {{{#!php
 <?php
 <div class="meta">
         <?php bp_group_type(); ?> / <?php bp_group_member_count(); ?>
 </div>
 }}}

 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;
 {{{#!php
 <?php
 <div class="meta">
         <?php do_action( 'bp_directory_groups_meta' ); ?>
 </div>
 }}}

 And here's my action which handles this custom functionality (for
 reference);
 {{{#!php
 <?php
 // 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' ) ) {
         bp_group_type();
         echo ' / ';
         bp_group_member_count();
     } else if ( ! empty( groups_get_groupmeta( $group->id, 'forum_id' ) )
 ) {
         bp_group_member_count();
     }
 }
 }}}

 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

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7071>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list