Changeset 2788 for branches/plugin/bbp-includes/bbp-functions.php
- Timestamp:
- 01/09/2011 09:19:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-functions.php
r2787 r2788 1988 1988 1989 1989 /** 1990 * Custom page title for bbPress User Profile Pages1991 * 1992 * @since bbPress (r2 688)1990 * Custom page title for bbPress pages 1991 * 1992 * @since bbPress (r2788) 1993 1993 * 1994 1994 * @param string $title Optional. The title (not used). 1995 * @param string $sep Optional, default is '»'. How to separate the various items within the page title. 1995 * @param string $sep Optional, default is '»'. How to separate the 1996 * various items within the page title. 1996 1997 * @param string $seplocation Optional. Direction to display title, 'right'. 1997 1998 * @uses bbp_is_user_profile_page() To check if it's a user profile page … … 1999 2000 * @uses get_query_var() To get the user id 2000 2001 * @uses get_userdata() To get the user data 2001 * @uses apply_filters() Calls 'bbp_profile_page_wp_raw_title' with the user's 2002 * display name, separator and separator location 2002 * @uses apply_filters() Calls 'bbp_raw_title' with the title 2003 2003 * @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title, 2004 2004 * separator and separator location 2005 2005 * @return string The tite 2006 2006 */ 2007 function bbp_profile_page_title( $title = '', $sep = '»', $seplocation = '' ) { 2008 if ( !bbp_is_user_profile_page() && !bbp_is_user_profile_edit() ) 2009 return; 2010 2011 $userdata = get_userdata( get_query_var( 'bbp_user_id' ) ); 2012 $title = apply_filters( 'bbp_profile_page_wp_raw_title', $userdata->display_name, $sep, $seplocation ); 2013 $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary 2014 2007 function bbp_title( $title = '', $sep = '»', $seplocation = '' ) { 2008 global $bbp; 2009 2010 $_title = $title; 2011 2012 // Profile page 2013 if ( bbp_is_user_profile_page() ) { 2014 2015 if ( bbp_is_user_home() ) { 2016 $title = __( 'Your Profile', 'bbpress' ); 2017 } else { 2018 $userdata = get_userdata( get_query_var( 'bbp_user_id' ) ); 2019 $title = sprintf( __( '%s\'s Profile', 'bbpress' ), $userdata->display_name ); 2020 } 2021 2022 // Profile edit page 2023 } elseif ( bbp_is_user_profile_edit() ) { 2024 2025 if ( bbp_is_user_home() ) { 2026 $title = __( 'Edit Your Profile', 'bbpress' ); 2027 } else { 2028 $userdata = get_userdata( get_query_var( 'bbp_user_id' ) ); 2029 $title = sprintf( __( 'Edit %s\'s Profile', 'bbpress' ), $userdata->display_name ); 2030 } 2031 2032 // Forum page 2033 } elseif ( bbp_is_forum() ) { 2034 2035 $title = sprintf( __( 'Forum: %s', 'bbpress' ), bbp_get_forum_title() ); 2036 2037 // Topic page 2038 } elseif ( bbp_is_topic() ) { 2039 2040 $title = sprintf( __( 'Topic: %s', 'bbpress' ), bbp_get_topic_title() ); 2041 2042 // Replies 2043 } elseif ( bbp_is_reply() ) { 2044 2045 // Normal reply titles already have "Reply To: ", so we shouldn't add our own 2046 $title = bbp_get_reply_title(); 2047 2048 } elseif ( is_tax( $bbp->topic_tag_id ) ) { 2049 2050 $term = get_queried_object(); 2051 $title = sprintf( __( 'Topic Tag: %s', 'bbpress' ), $term->name ); 2052 2053 } 2054 2055 $title = apply_filters( 'bbp_raw_title', $title, $sep, $seplocation ); 2056 2057 if ( $title == $_title ) 2058 return $title; 2059 2060 // Temporary separator, for accurate flipping, if necessary 2061 $t_sep = '%WP_TITILE_SEP%'; 2015 2062 $prefix = ''; 2063 2016 2064 if ( !empty( $title ) ) 2017 2065 $prefix = " $sep "; … … 2027 2075 } 2028 2076 2029 $title = apply_filters( 'bbp_ profile_page_wp_title', $title, $sep, $seplocation );2077 $title = apply_filters( 'bbp_title', $title, $sep, $seplocation ); 2030 2078 2031 2079 return $title;
Note: See TracChangeset
for help on using the changeset viewer.