Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/27/2010 10:21:26 PM (14 years ago)
Author:
djpaul
Message:

Allow any component to be set to display on the front page. Fixes #2743.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/functions.php

    r3462 r3488  
    155155
    156156/**
    157  * Filter the dropdown for selecting the page to show on front to include "Activity Stream"
    158  *
     157 * In BuddyPress 1.2.x, this function filtered the dropdown on the Settings > Reading screen for selecting
     158 * the page to show on front to include "Activity Stream."
     159 * As of 1.3.x, it is no longer required.
     160 *
     161 * @deprecated 1.3
     162 * @deprecated No longer required.
    159163 * @param string $page_html A list of pages as a dropdown (select list)
     164 * @return string
    160165 * @see wp_dropdown_pages()
    161  * @return string
    162  * @package BuddyPress Theme
    163166 * @since 1.2
    164167 */
    165168function bp_dtheme_wp_pages_filter( $page_html ) {
    166     if ( !bp_is_active( 'activity' ) )
    167         return $page_html;
    168 
    169     if ( 'page_on_front' != substr( $page_html, 14, 13 ) )
    170         return $page_html;
    171 
    172     $selected = false;
    173     $page_html = str_replace( '</select>', '', $page_html );
    174 
    175     if ( bp_dtheme_page_on_front() == 'activity' )
    176         $selected = ' selected="selected"';
    177 
    178     $page_html .= '<option class="level-0" value="activity"' . $selected . '>' . __( 'Activity Stream', 'buddypress' ) . '</option></select>';
     169    _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
    179170    return $page_html;
    180171}
    181 add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
    182 
    183 /**
    184  * Hijack the saving of page on front setting to save the activity stream setting
    185  *
     172
     173/**
     174 * In BuddyPress 1.2.x, this function hijacked the saving of page on front setting to save the activity stream setting.
     175 * As of 1.3.x, it is no longer required.
     176 *
     177 * @deprecated 1.3
     178 * @deprecated No longer required.
    186179 * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
    187180 * @param $string $oldvalue New value of get_option( 'page_on_front' )
    188181 * @return string
    189  * @package BuddyPress Theme
    190182 * @since 1.2
    191183 */
    192184function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
     185    _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
    193186    if ( !is_admin() || !is_super_admin() )
    194187        return false;
    195188
    196     if ( 'activity' == $_POST['page_on_front'] )
    197         return 'activity';
    198     else
    199         return $oldvalue;
    200 }
    201 add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
    202 
    203 /**
    204  * Load the activity stream template if settings allow
    205  *
     189    return $oldvalue;
     190}
     191
     192/**
     193 * In BuddyPress 1.2.x, this function loaded the activity stream template if the front page display settings allow.
     194 * As of 1.3.x, it is no longer required.
     195 *
     196 * @deprecated 1.3
     197 * @deprecated No longer required.
    206198 * @param string $template Absolute path to the page template
    207199 * @return string
    208  * @global WP_Query $wp_query WordPress query object
    209  * @package BuddyPress Theme
    210200 * @since 1.2
    211201 */
    212202function bp_dtheme_page_on_front_template( $template ) {
    213     global $wp_query;
    214 
    215     if ( empty( $wp_query->post->ID ) )
    216         return locate_template( array( 'activity/index.php' ), false );
    217     else
    218         return $template;
    219 }
    220 add_filter( 'page_template', 'bp_dtheme_page_on_front_template' );
     203    _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
     204    return $template;
     205}
    221206
    222207/**
     
    224209 *
    225210 * @return false|int ID of page set as the home page
    226  * @package BuddyPress Theme
    227211 * @since 1.2
    228212 */
     
    235219
    236220/**
    237  * Force the page ID as a string to stop the get_posts query from kicking up a fuss.
    238  *
    239  * @global WP_Query $wp_query WordPress query object
    240  * @package BuddyPress Theme
     221 * In BuddyPress 1.2.x, this forced the page ID as a string to stop the get_posts query from kicking up a fuss.
     222 * As of 1.3.x, it is no longer required.
     223 *
     224 * @deprecated 1.3
     225 * @deprecated No longer required.
    241226 * @since 1.2
    242227 */
    243228function bp_dtheme_fix_get_posts_on_activity_front() {
    244     global $wp_query;
    245 
    246     if ( !empty($wp_query->query_vars['page_id']) && 'activity' == $wp_query->query_vars['page_id'] )
    247         $wp_query->query_vars['page_id'] = '"activity"';
    248 }
    249 add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' );
    250 
    251 /**
    252  * WP 3.0 requires there to be a non-null post in the posts array
    253  *
     229    _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
     230}
     231
     232/**
     233 * In BuddyPress 1.3, this was used as part of the code that set the activity stream to be on the front page.
     234 * As of 1.3.x, it is no longer required.
     235 *
     236 * @deprecated 1.3
     237 * @deprecated No longer required.
    254238 * @param array $posts Posts as retrieved by WP_Query
    255  * @global WP_Query $wp_query WordPress query object
    256239 * @return array
    257  * @package BuddyPress Theme
    258240 * @since 1.2.5
    259241 */
    260242function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
    261     global $wp_query;
    262 
    263     // NOTE: the double quotes around '"activity"' are thanks to our previous function bp_dtheme_fix_get_posts_on_activity_front()
    264     if ( empty( $posts ) && !empty( $wp_query->query_vars['page_id'] ) && '"activity"' == $wp_query->query_vars['page_id'] )
    265         $posts = array( (object) array( 'ID' => 'activity' ) );
    266 
     243    _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
    267244    return $posts;
    268245}
    269 add_filter( 'the_posts', 'bp_dtheme_fix_the_posts_on_activity_front' );
    270246
    271247/**
     
    406382?>
    407383    <ul id="nav">
    408         <li<?php if ( bp_is_front_page() ) : ?> class="selected"<?php endif; ?>>
     384        <li<?php if ( is_front_page() ) : ?> class="selected"<?php endif; ?>>
    409385            <a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a>
    410386        </li>
Note: See TracChangeset for help on using the changeset viewer.