[buddypress-trac] [BuddyPress Trac] #7025: Introduce a method for getting a component's page_id

buddypress-trac noreply at wordpress.org
Fri Apr 22 15:26:06 UTC 2016


#7025: Introduce a method for getting a component's page_id
------------------------------+-----------------------------
 Reporter:  garrett-eclipse   |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Component - Core  |    Version:  2.5.0
 Severity:  normal            |   Keywords:
------------------------------+-----------------------------
 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
 <?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

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


More information about the buddypress-trac mailing list