Skip to:
Content

BuddyPress.org

Changeset 3496


Ignore:
Timestamp:
12/01/2010 09:16:41 PM (16 years ago)
Author:
djpaul
Message:

Refactor functions.php to use appropriate theme-loading actions.
Improved support for custom thumbnails; now supports global page header as well as a per-post/page header.
Key functions are now hookable.
Add full phpDoc.
Props to the WordPress team and Twenty Ten for some of the phpDoc.
Fixes #2749, #2754, #2751.

Location:
trunk/bp-themes/bp-default
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/css/default.css

    r3458 r3496  
    7171        position: relative;
    7272        color: #fff;
    73         background: url( ../images/default_header.jpg);
    7473        -moz-border-radius-bottomleft: 6px;
    7574        -webkit-border-bottom-left-radius: 6px;
  • trunk/bp-themes/bp-default/functions.php

    r3488 r3496  
    11<?php
    2 // Stop the theme from killing WordPress if BuddyPress is not enabled.
    3 if ( !class_exists( 'BP_Core_User' ) )
    4         return false;
    5 
    6 add_theme_support( 'automatic-feed-links' );
    7 
    8 // This theme allows users to set a custom background
    9 add_custom_background();
    10 
    11 // Register the widget columns
    12 // Area 1, located in the sidebar. Empty by default.
    13 register_sidebar( array(
    14         'name'          => 'Sidebar',
    15         'description'   => __( 'The sidebar widget area', 'buddypress' ),
    16         'before_widget' => '<div id="%1$s" class="widget %2$s">',
    17         'after_widget'  => '</div>',
    18         'before_title'  => '<h3 class="widgettitle">',
    19         'after_title'   => '</h3>'
    20 ) );
    21 
    22 // Area 2, located in the footer. Empty by default.
    23 register_sidebar( array(
    24         'name' => __( 'First Footer Widget Area', 'buddypress' ),
    25         'id' => 'first-footer-widget-area',
    26         'description' => __( 'The first footer widget area', 'buddypress' ),
    27         'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    28         'after_widget' => '</li>',
    29         'before_title' => '<h3 class="widgettitle">',
    30         'after_title' => '</h3>',
    31 ) );
    32 
    33 // Area 3, located in the footer. Empty by default.
    34 register_sidebar( array(
    35         'name' => __( 'Second Footer Widget Area', 'buddypress' ),
    36         'id' => 'second-footer-widget-area',
    37         'description' => __( 'The second footer widget area', 'buddypress' ),
    38         'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    39         'after_widget' => '</li>',
    40         'before_title' => '<h3 class="widgettitle">',
    41         'after_title' => '</h3>',
    42 ) );
    43 
    44 // Area 4, located in the footer. Empty by default.
    45 register_sidebar( array(
    46         'name' => __( 'Third Footer Widget Area', 'buddypress' ),
    47         'id' => 'third-footer-widget-area',
    48         'description' => __( 'The third footer widget area', 'buddypress' ),
    49         'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    50         'after_widget' => '</li>',
    51         'before_title' => '<h3 class="widgettitle">',
    52         'after_title' => '</h3>',
    53 ) );
    54 
    55 // Area 5, located in the footer. Empty by default.
    56 register_sidebar( array(
    57         'name' => __( 'Fourth Footer Widget Area', 'buddypress' ),
    58         'id' => 'fourth-footer-widget-area',
    59         'description' => __( 'The fourth footer widget area', 'buddypress' ),
    60         'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    61         'after_widget' => '</li>',
    62         'before_title' => '<h3 class="widgettitle">',
    63         'after_title' => '</h3>',
    64 ) );
    65 
    66 // Register navigation menu
    67 register_nav_menus( array(
    68         'primary' => __( 'Primary Navigation', 'buddypress' ),
    69 ) );
    70 
    71 // Load the AJAX functions for the theme
    72 require_once( TEMPLATEPATH . '/_inc/ajax.php' );
    73 
    74 // Load the javascript for the theme
    75 wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
    76 
    77 // Add words that we need to use in JS to the end of the page so they can be translated and still used.
    78 $params = array(
    79         'my_favs'           => __( 'My Favorites', 'buddypress' ),
    80         'accepted'          => __( 'Accepted', 'buddypress' ),
    81         'rejected'          => __( 'Rejected', 'buddypress' ),
    82         'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
    83         'show_all'          => __( 'Show all', 'buddypress' ),
    84         'comments'          => __( 'comments', 'buddypress' ),
    85         'close'             => __( 'Close', 'buddypress' )
    86 );
    87 
    88 global $bp;
    89 if ( isset( $bp->displayed_user->id ) )
    90         $params['mention_explain'] = sprintf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) );
    91 
    92 wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
     2/**
     3 * BP-Default theme functions and definitions
     4 *
     5 * Sets up the theme and provides some helper functions. Some helper functions
     6 * are used in the theme as custom template tags. Others are attached to action and
     7 * filter hooks in WordPress and BuddyPress to change core functionality.
     8 *
     9 * The first function, bp_dtheme_setup(), sets up the theme by registering support
     10 * for various features in WordPress, such as post thumbnails and navigation menus, and
     11 * for BuddyPress, action buttons and javascript localisation.
     12 *
     13 * When using a child theme (see http://codex.wordpress.org/Theme_Development, http://codex.wordpress.org/Child_Themes
     14 * and http://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/), you can override
     15 * certain functions (those wrapped in a function_exists() call) by defining them first in your
     16 * child theme's functions.php file. The child theme's functions.php file is included before the
     17 * parent theme's file, so the child theme functions would be used.
     18 *
     19 * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
     20 * to a filter or action hook. The hook can be removed by using remove_action() or
     21 * remove_filter() and you can attach your own function to the hook.
     22 *
     23 * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
     24 *
     25 * @package BuddyPress
     26 * @subpackage BP-Default
     27 * @since 1.2
     28 */
     29
     30if ( !function_exists( 'bp_dtheme_setup' ) ) :
     31/**
     32 * Sets up theme defaults and registers support for various WordPress and BuddyPress features.
     33 *
     34 * Note that this function is hooked into the after_setup_theme hook, which runs
     35 * before the init hook. The init hook is too late for some features, such as indicating
     36 * support post thumbnails.
     37 *
     38 * To override bp_dtheme_setup() in a child theme, add your own bp_dtheme_setup to your child theme's
     39 * functions.php file.
     40 *
     41 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     42 * @since 1.3
     43 */
     44function bp_dtheme_setup() {
     45        global $bp;
     46
     47        // Load the AJAX functions for the theme
     48        require_once( TEMPLATEPATH . '/_inc/ajax.php' );
     49
     50        // This theme uses post thumbnails
     51        add_theme_support( 'post-thumbnails' );
     52
     53        // Add default posts and comments RSS feed links to head
     54        add_theme_support( 'automatic-feed-links' );
     55
     56        // This theme uses wp_nav_menu() in one location.
     57        register_nav_menus( array(
     58                'primary' => __( 'Primary Navigation', 'buddypress' ),
     59        ) );
     60
     61        // This theme allows users to set a custom background
     62        add_custom_background();
     63
     64        // Changeable header section starts here
     65        define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
     66        // No CSS. The %s is a placeholder for the theme template directory URI.
     67        define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' );
     68
     69        // The height and width of your custom header. You can hook into the theme's own filters to change these values.
     70        // Add a filter to bp_dtheme_header_image_width and bp_dtheme_header_image_height to change these values.
     71        define( 'HEADER_IMAGE_WIDTH', apply_filters( 'bp_dtheme_header_image_width', 1250 ) );
     72        define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'bp_dtheme_header_image_height', 100 ) );
     73
     74        // We'll be using post thumbnails for custom header images on posts and pages. We want them to be 1250 pixels wide by 100 pixels tall.
     75        // Larger images will be auto-cropped to fit, smaller ones will be ignored.
     76        set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
     77
     78        // Add a way for the custom header to be styled in the admin panel that controls custom headers.
     79        add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
     80
     81        //End of changeable header section
     82
     83        // Load the javascript for the theme
     84        wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
     85
     86        // Add words that we need to use in JS to the end of the page so they can be translated and still used.
     87        $params = array(
     88                'my_favs'           => __( 'My Favorites', 'buddypress' ),
     89                'accepted'          => __( 'Accepted', 'buddypress' ),
     90                'rejected'          => __( 'Rejected', 'buddypress' ),
     91                'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
     92                'show_all'          => __( 'Show all', 'buddypress' ),
     93                'comments'          => __( 'comments', 'buddypress' ),
     94                'close'             => __( 'Close', 'buddypress' )
     95        );
     96
     97        if ( !empty( $bp->displayed_user->id ) )
     98                $params['mention_explain'] = sprintf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) );
     99
     100        wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
     101
     102        // Register buttons for the relevant component templates
     103        // Friends button
     104        if ( bp_is_active( 'friends' ) )
     105                add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
     106
     107        // Activity button
     108        if ( bp_is_active( 'activity' ) )
     109                add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
     110
     111        // Messages button
     112        if ( bp_is_active( 'messages' ) )
     113                add_action( 'bp_member_header_actions',    'bp_send_private_message_button' );
     114
     115        // Group buttons
     116        if ( bp_is_active( 'groups' ) ) {
     117                add_action( 'bp_group_header_actions',     'bp_group_join_button' );
     118                add_action( 'bp_group_header_actions',     'bp_group_new_topic_button' );
     119                add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
     120        }
     121
     122        // Blog button
     123        if ( bp_is_active( 'blogs' ) )
     124                add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
     125}
     126add_action( 'after_setup_theme', 'bp_dtheme_setup' );
     127endif;
     128
     129if ( !function_exists( 'bp_dtheme_admin_header_style' ) ) :
     130/**
     131 * Styles the header image displayed on the Appearance > Header admin panel.
     132 *
     133 * Referenced via add_custom_image_header() in bp_dtheme_setup().
     134 *
     135 * @since 1.2
     136 */
     137function bp_dtheme_admin_header_style() {
     138?>
     139        <style type="text/css">
     140                #headimg {
     141                        position: relative;
     142                        color: #fff;
     143                        background: url(<?php header_image() ?>);
     144                        -moz-border-radius-bottomleft: 6px;
     145                        -webkit-border-bottom-left-radius: 6px;
     146                        -moz-border-radius-bottomright: 6px;
     147                        -webkit-border-bottom-right-radius: 6px;
     148                        margin-bottom: 20px;
     149                        height: 100px;
     150                        padding-top: 25px;
     151                }
     152
     153                #headimg h1{
     154                        position: absolute;
     155                        bottom: 15px;
     156                        left: 15px;
     157                        width: 44%;
     158                        margin: 0;
     159                        font-family: Arial, Tahoma, sans-serif;
     160                }
     161                #headimg h1 a{
     162                        color:#<?php header_textcolor() ?>;
     163                        text-decoration: none;
     164                        border-bottom: none;
     165                }
     166                #headimg #desc{
     167                        color:#<?php header_textcolor() ?>;
     168                        font-size:1em;
     169                        margin-top:-0.5em;
     170                }
     171
     172                #desc {
     173                        display: none;
     174                }
     175
     176                <?php if ( 'blank' == get_header_textcolor() ) { ?>
     177                #headimg h1, #headimg #desc {
     178                        display: none;
     179                }
     180                #headimg h1 a, #headimg #desc {
     181                        color:#<?php echo HEADER_TEXTCOLOR ?>;
     182                }
     183                <?php } ?>
     184        </style>
     185<?php
     186}
     187endif;
     188
     189if ( !function_exists( 'bp_dtheme_header_style' ) ) :
     190/**
     191 * The styles for the post thumbnails / custom page headers.
     192 *
     193 * Referenced via add_custom_image_header() in bp_dtheme_setup().
     194 *
     195 * @global WP_Query $post The current WP_Query object for the current post or page
     196 * @since 1.2
     197 */
     198function bp_dtheme_header_style() {
     199        global $post;
     200
     201        if ( is_singular() && has_post_thumbnail( $post->ID ) ) {
     202                $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' );
     203
     204                // $src, $width, $height
     205                if ( !empty( $image ) && $image[1] >= HEADER_IMAGE_WIDTH )
     206                        $header_image = $image[0];
     207        }
     208
     209        if ( empty( $header_image ) )
     210                $header_image = get_header_image();
     211?>
     212        <style type="text/css">
     213                #header { background-image: url(<?php echo $header_image ?>); }
     214                <?php if ( 'blank' == get_header_textcolor() ) { ?>
     215                #header h1, #header #desc { display: none; }
     216                <?php } else { ?>
     217                #header h1 a, #desc { color:#<?php header_textcolor() ?>; }
     218                <?php } ?>
     219        </style>
     220<?php
     221}
     222endif;
     223
     224/**
     225 * Register widgetised areas, including one sidebar and four widget-ready columns in the footer.
     226 *
     227 * To override bp_dtheme_widgets_init() in a child theme, remove the action hook and add your own
     228 * function tied to the init hook.
     229 *
     230 * @since 1.3
     231 */
     232function bp_dtheme_widgets_init() {
     233        // Register the widget columns
     234        // Area 1, located in the sidebar. Empty by default.
     235        register_sidebar( array(
     236                'name'          => 'Sidebar',
     237                'description'   => __( 'The sidebar widget area', 'buddypress' ),
     238                'before_widget' => '<div id="%1$s" class="widget %2$s">',
     239                'after_widget'  => '</div>',
     240                'before_title'  => '<h3 class="widgettitle">',
     241                'after_title'   => '</h3>'
     242        ) );
     243
     244        // Area 2, located in the footer. Empty by default.
     245        register_sidebar( array(
     246                'name' => __( 'First Footer Widget Area', 'buddypress' ),
     247                'id' => 'first-footer-widget-area',
     248                'description' => __( 'The first footer widget area', 'buddypress' ),
     249                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
     250                'after_widget' => '</li>',
     251                'before_title' => '<h3 class="widgettitle">',
     252                'after_title' => '</h3>',
     253        ) );
     254
     255        // Area 3, located in the footer. Empty by default.
     256        register_sidebar( array(
     257                'name' => __( 'Second Footer Widget Area', 'buddypress' ),
     258                'id' => 'second-footer-widget-area',
     259                'description' => __( 'The second footer widget area', 'buddypress' ),
     260                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
     261                'after_widget' => '</li>',
     262                'before_title' => '<h3 class="widgettitle">',
     263                'after_title' => '</h3>',
     264        ) );
     265
     266        // Area 4, located in the footer. Empty by default.
     267        register_sidebar( array(
     268                'name' => __( 'Third Footer Widget Area', 'buddypress' ),
     269                'id' => 'third-footer-widget-area',
     270                'description' => __( 'The third footer widget area', 'buddypress' ),
     271                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
     272                'after_widget' => '</li>',
     273                'before_title' => '<h3 class="widgettitle">',
     274                'after_title' => '</h3>',
     275        ) );
     276
     277        // Area 5, located in the footer. Empty by default.
     278        register_sidebar( array(
     279                'name' => __( 'Fourth Footer Widget Area', 'buddypress' ),
     280                'id' => 'fourth-footer-widget-area',
     281                'description' => __( 'The fourth footer widget area', 'buddypress' ),
     282                'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
     283                'after_widget' => '</li>',
     284                'before_title' => '<h3 class="widgettitle">',
     285                'after_title' => '</h3>',
     286        ) );
     287}
     288add_action( 'widgets_init', 'bp_dtheme_widgets_init' );
    93289
    94290/**
    95291 * Add the JS needed for blog comment replies
    96292 *
    97  * @package BuddyPress Theme
    98293 * @since 1.2
    99294 */
     
    104299add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
    105300
    106 /**
    107  * HTML for outputting blog comments as defined by the WP comment API
     301if ( !function_exists( 'bp_dtheme_blog_comments' ) ) :
     302/**
     303 * Template for comments and pingbacks.
     304 *
     305 * To override this walker in a child theme without modifying the comments template
     306 * simply create your own bp_dtheme_blog_comments(), and that function will be used instead.
     307 *
     308 * Used as a callback by wp_list_comments() for displaying the comments.
    108309 *
    109310 * @param mixed $comment Comment record from database
     
    111312 * @param int $depth Comment nesting level
    112313 * @see wp_list_comments()
    113  * @package BuddyPress Theme
    114314 * @since 1.2
    115315 */
     
    140340
    141341                        <?php if ( $comment->comment_approved == '0' ) : ?>
    142                                 <em class="moderate"><?php _e('Your comment is awaiting moderation.'); ?></em><br />
     342                                <em class="moderate"><?php _e( 'Your comment is awaiting moderation.', 'buddypress' ); ?></em><br />
    143343                        <?php endif; ?>
    144344
     
    146346
    147347                        <div class="comment-options">
    148                                 <?php echo comment_reply_link( array('depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ?>
    149                                 <?php edit_comment_link( __( 'Edit' ),'','' ); ?>
     348                                <?php echo comment_reply_link( array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ?>
     349                                <?php edit_comment_link( __( 'Edit', 'buddypress' ), '', '' ); ?>
    150350                        </div>
    151351
     
    153353<?php
    154354}
    155 
    156 /**
    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.
    163  * @param string $page_html A list of pages as a dropdown (select list)
    164  * @return string
    165  * @see wp_dropdown_pages()
    166  * @since 1.2
    167  */
    168 function bp_dtheme_wp_pages_filter( $page_html ) {
    169         _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
    170         return $page_html;
    171 }
    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.
    179  * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
    180  * @param $string $oldvalue New value of get_option( 'page_on_front' )
    181  * @return string
    182  * @since 1.2
    183  */
    184 function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
    185         _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
    186         if ( !is_admin() || !is_super_admin() )
    187                 return false;
    188 
    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.
    198  * @param string $template Absolute path to the page template
    199  * @return string
    200  * @since 1.2
    201  */
    202 function bp_dtheme_page_on_front_template( $template ) {
    203         _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
    204         return $template;
    205 }
     355endif;
    206356
    207357/**
     
    219369
    220370/**
    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.
    226  * @since 1.2
    227  */
    228 function bp_dtheme_fix_get_posts_on_activity_front() {
    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.
    238  * @param array $posts Posts as retrieved by WP_Query
    239  * @return array
    240  * @since 1.2.5
    241  */
    242 function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
    243         _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
    244         return $posts;
    245 }
    246 
    247 /**
    248  * Add secondary avatar image to this activity stream's record, if supported
     371 * Add secondary avatar image to this activity stream's record, if supported.
    249372 *
    250373 * @param string $action The text of this activity
    251374 * @param BP_Activity_Activity $activity Activity object
     375 * @package BuddyPress Theme
    252376 * @return string
    253  * @package BuddyPress Theme
    254377 * @since 1.2.6
    255378 */
     
    273396
    274397/**
    275  * Custom header image support. You can remove this entirely in a child theme by adding this line
    276  * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
    277  *
    278  * @package BuddyPress Theme
    279  * @since 1.2
    280  */
    281 function bp_dtheme_add_custom_header_support() {
    282         // Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/)
    283         define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
    284         define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
    285         define( 'HEADER_IMAGE_WIDTH', 1250 );
    286         define( 'HEADER_IMAGE_HEIGHT', 125 );
    287 
    288         function bp_dtheme_header_style() { ?>
    289                 <style type="text/css">
    290                         #header { background-image: url(<?php header_image() ?>); }
    291                         <?php if ( 'blank' == get_header_textcolor() ) { ?>
    292                         #header h1, #header #desc { display: none; }
    293                         <?php } else { ?>
    294                         #header h1 a, #desc { color:#<?php header_textcolor() ?>; }
    295                         <?php } ?>
    296                 </style>
    297         <?php
    298         }
    299 
    300         function bp_dtheme_admin_header_style() { ?>
    301                 <style type="text/css">
    302                         #headimg {
    303                                 position: relative;
    304                                 color: #fff;
    305                                 background: url(<?php header_image() ?>);
    306                                 -moz-border-radius-bottomleft: 6px;
    307                                 -webkit-border-bottom-left-radius: 6px;
    308                                 -moz-border-radius-bottomright: 6px;
    309                                 -webkit-border-bottom-right-radius: 6px;
    310                                 margin-bottom: 20px;
    311                                 height: 100px;
    312                                 padding-top: 25px;
    313                         }
    314 
    315                         #headimg h1{
    316                                 position: absolute;
    317                                 bottom: 15px;
    318                                 left: 15px;
    319                                 width: 44%;
    320                                 margin: 0;
    321                                 font-family: Arial, Tahoma, sans-serif;
    322                         }
    323                         #headimg h1 a{
    324                                 color:#<?php header_textcolor() ?>;
    325                                 text-decoration: none;
    326                                 border-bottom: none;
    327                         }
    328                         #headimg #desc{
    329                                 color:#<?php header_textcolor() ?>;
    330                                 font-size:1em;
    331                                 margin-top:-0.5em;
    332                         }
    333 
    334                         #desc {
    335                                 display: none;
    336                         }
    337 
    338                         <?php if ( 'blank' == get_header_textcolor() ) { ?>
    339                         #headimg h1, #headimg #desc {
    340                                 display: none;
    341                         }
    342                         #headimg h1 a, #headimg #desc {
    343                                 color:#<?php echo HEADER_TEXTCOLOR ?>;
    344                         }
    345                         <?php } ?>
    346                 </style>
    347         <?php
    348         }
    349         add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
    350 }
    351 if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
    352         add_action( 'init', 'bp_dtheme_add_custom_header_support' );
    353 
    354 /**
    355398 * Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html)
    356399 *
    357  * @package BuddyPress Theme
    358400 * @since 1.2
    359401 */
     
    392434}
    393435
    394 // Member Buttons
    395 if ( bp_is_active( 'friends' ) )
    396         add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
    397 
    398 if ( bp_is_active( 'activity' ) )
    399         add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
    400 
    401 if ( bp_is_active( 'messages' ) )
    402         add_action( 'bp_member_header_actions',    'bp_send_private_message_button' );
    403 
    404 // Group Buttons
    405 if ( bp_is_active( 'groups' ) ) {
    406         add_action( 'bp_group_header_actions',     'bp_group_join_button' );
    407         add_action( 'bp_group_header_actions',     'bp_group_new_topic_button' );
    408         add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
    409 }
    410 
    411 // Blog Buttons
    412 if ( bp_is_active( 'blogs' ) )
    413         add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
     436// Everything beyond this point is deprecated as of BuddyPress 1.3. This will be removed in a future version.
     437
     438/**
     439 * In BuddyPress 1.2.x, this function filtered the dropdown on the Settings > Reading screen for selecting
     440 * the page to show on front to include "Activity Stream."
     441 * As of 1.3.x, it is no longer required.
     442 *
     443 * @deprecated 1.3
     444 * @deprecated No longer required.
     445 * @param string $page_html A list of pages as a dropdown (select list)
     446 * @return string
     447 * @see wp_dropdown_pages()
     448 * @since 1.2
     449 */
     450function bp_dtheme_wp_pages_filter( $page_html ) {
     451        _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
     452        return $page_html;
     453}
     454
     455/**
     456 * In BuddyPress 1.2.x, this function hijacked the saving of page on front setting to save the activity stream setting.
     457 * As of 1.3.x, it is no longer required.
     458 *
     459 * @deprecated 1.3
     460 * @deprecated No longer required.
     461 * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
     462 * @param $string $oldvalue New value of get_option( 'page_on_front' )
     463 * @return string
     464 * @since 1.2
     465 */
     466function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
     467        _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
     468        if ( !is_admin() || !is_super_admin() )
     469                return false;
     470
     471        return $oldvalue;
     472}
     473
     474/**
     475 * In BuddyPress 1.2.x, this function loaded the activity stream template if the front page display settings allow.
     476 * As of 1.3.x, it is no longer required.
     477 *
     478 * @deprecated 1.3
     479 * @deprecated No longer required.
     480 * @param string $template Absolute path to the page template
     481 * @return string
     482 * @since 1.2
     483 */
     484function bp_dtheme_page_on_front_template( $template ) {
     485        _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
     486        return $template;
     487}
     488
     489/**
     490 * In BuddyPress 1.2.x, this forced the page ID as a string to stop the get_posts query from kicking up a fuss.
     491 * As of 1.3.x, it is no longer required.
     492 *
     493 * @deprecated 1.3
     494 * @deprecated No longer required.
     495 * @since 1.2
     496 */
     497function bp_dtheme_fix_get_posts_on_activity_front() {
     498        _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
     499}
     500
     501/**
     502 * In BuddyPress 1.3, this was used as part of the code that set the activity stream to be on the front page.
     503 * As of 1.3.x, it is no longer required.
     504 *
     505 * @deprecated 1.3
     506 * @deprecated No longer required.
     507 * @param array $posts Posts as retrieved by WP_Query
     508 * @return array
     509 * @since 1.2.5
     510 */
     511function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
     512        _deprecated_function( __FUNCTION__, '1.3', "No longer required." );
     513        return $posts;
     514}
    414515?>
Note: See TracChangeset for help on using the changeset viewer.