Opened 9 years ago
Closed 9 years ago
#7025 closed enhancement (fixed)
Introduce a method for getting a component's page_id
Reported by: | garrett-eclipse | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | 2.5.0 |
Component: | Core | Keywords: | needs-patch good-first-bug |
Cc: |
Description
Hello,
I'd like to request a method which takes a component slug and returns the page_id associated.
Something like this would suffice, having it default to use bp_current_component if slug isn't provided.
<?php /** * Get the page ID associated with component slug * * @since 1.0.0 * * @param string $component The slug representing the component. * @return int The page_id associated with the component. */ function components_get_page_id( $component = NULL ) { if ( empty( $component ) ) { $component = bp_current_component(); } $bp_pages = get_option( 'bp-pages' ); if ( empty( $bp_pages ) { return false; } return $bp_pages[$component]; }
Much appreciated,
Cheers
Change History (4)
Note: See
TracTickets for help on using
tickets.
In 10755: