[buddypress-trac] [BuddyPress Trac] #7342: Enhancement request: Check if a member type directory is being viewed

buddypress-trac noreply at wordpress.org
Sun Nov 13 03:31:08 UTC 2016


#7342: Enhancement request: Check if a member type directory is being viewed
--------------------------+----------------------------------
 Reporter:  henry.wright  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Under Consideration
Component:  Core          |     Version:  2.7.2
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |
--------------------------+----------------------------------

Comment (by boonebgorges):

 Replying to [comment:1 slaFFik]:
 > I believe, it's better to have 2 params: `bp_is_directory( $component,
 $args )`
 > So in your example to have something like:
 > {{{#!php
 > if ( bp_is_directory( buddypress()->members->id, [ 'type' => 'student' ]
 ) ) {}
 > }}}

 This is a decent suggestion, but I see two possible issues.

 1. We have component-specific functions like `bp_is_members_directory()`,
 `bp_is_groups_directory()`, etc. The internal logic for these functions is
 quite different for each component, so you'd have to hardcode a `switch()`
 statement of some sort into `bp_is_directory()`. This would create an odd
 experience when passing a custom `$component` to the function.

 2. Not all components support 'types', creating an inconsistent interface.

 How about `bp_is_members_directory( [ 'type' => 'student' ] )` etc?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7342#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list