Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 7 years ago

#7342 closed enhancement (maybelater)

Enhancement request: Check if a member type directory is being viewed

Reported by: henrywright's profile henry.wright Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7.2
Component: Core Keywords: needs-patch, trac-tidy-2018
Cc:

Description

I'm not sure of the best way to do this. Maybe bp_is_directory() can be modified to accept a string argument?

if ( bp_is_directory( 'student' ) ) {
    // example.com/members/type/student is currently being viewed.
}

Change History (7)

#1 follow-up: @slaFFik
8 years ago

  • Keywords dev-feedback added
  • Milestone changed from Awaiting Review to Under Consideration
  • Type changed from defect (bug) to enhancement

I believe, it's better to have 2 params: bp_is_directory( $component, $args )
So in your example to have something like:

if ( bp_is_directory( buddypress()->members->id, [ 'type' => 'student' ] ) ) {}

#2 in reply to: ↑ 1 ; follow-up: @boonebgorges
8 years ago

Replying to slaFFik:

I believe, it's better to have 2 params: bp_is_directory( $component, $args )
So in your example to have something like:

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.
  1. Not all components support 'types', creating an inconsistent interface.

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

#3 in reply to: ↑ 2 @henry.wright
8 years ago

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

I think you nailed it with that suggestion.

#4 @boonebgorges
8 years ago

  • Keywords needs-patch added; dev-feedback removed
  • Milestone changed from Under Consideration to Future Release

#5 @slaFFik
8 years ago

Can't it be done with just bp_is_members_directory() && bp_get_current_member_type() === 'student'?

#6 @DJPaul
7 years ago

  • Keywords trac-tidy-2018 added

We're closing this ticket because it has not received any contribution or comments for at least two years. We have decided that it is better to close tickets that are good ideas, which have not gotten (or are unlikely to get) contributions, rather than keep things open indefinitely. This will help us share a more realistic roadmap for BuddyPress with you.

Everyone very much appreciates the time and effort that you spent sharing your idea with us. On behalf of the entire BuddyPress team, thank you.

If you feel strongly that this enhancement should still be added to BuddyPress, and you are able to contribute effort towards it, we encourage you to re-open the ticket, or start a discussion about it in our Slack channel. Please consider that time has proven that good ideas without contributions do not get built.

For more information, see https://bpdevel.wordpress.com/2018/01/21/our-awaiting-contributions-milestone-contains/
or find us on Slack, in the #buddypress channel: https://make.wordpress.org/chat/

#7 @DJPaul
7 years ago

  • Milestone Awaiting Contributions deleted
  • Resolution set to maybelater
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.