Changeset 2696 for trunk/bp-themes/bp-default/functions.php
- Timestamp:
- 02/12/2010 12:48:30 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-themes/bp-default/functions.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/functions.php
r2676 r2696 22 22 wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) ); 23 23 24 function bp_dtheme_firstname( $name = false, $echo = false ) { 25 global $bp; 26 27 if ( !$name ) 28 $name = $bp->loggedin_user->fullname; 29 30 $fullname = (array)explode( ' ', $name ); 31 $firstname = apply_filters( 'bp_dtheme_firstname', $fullname[0], $fullname ); 32 33 if ( $echo ) 34 echo $firstname; 35 else 36 return $firstname; 37 } 38 24 /* Add the JS needed for blog comment replies */ 39 25 function bp_dtheme_add_blog_comments_js() { 40 26 if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); … … 42 28 add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' ); 43 29 30 /* HTML for outputting blog comments as defined by the WP comment API */ 44 31 function bp_dtheme_blog_comments( $comment, $args, $depth ) { 45 32 $GLOBALS['comment'] = $comment; ?> … … 83 70 } 84 71 72 /* Filter the dropdown for selecting the page to show on front to include "Activity Stream" */ 85 73 function bp_dtheme_wp_pages_filter( $page_html ) { 86 74 if ( 'page_on_front' != substr( $page_html, 14, 13 ) ) … … 98 86 add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' ); 99 87 88 /* Hijack the saving of page on front setting to save the activity stream setting */ 100 89 function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) { 101 90 if ( !is_admin() || !is_site_admin() ) … … 109 98 add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 ); 110 99 100 /* Load the activity stream template if settings allow */ 111 101 function bp_dtheme_page_on_front_template( $template ) { 112 102 global $wp_query; … … 212 202 add_action( 'init', 'bp_dtheme_add_custom_header_support' ); 213 203 214 function bp_dtheme_remove_redundant() { 215 global $bp; 216 217 /* Remove the navigation options we do not need in this theme. */ 218 bp_core_remove_subnav_item( $bp->blogs->slug, 'my-blogs' ); 219 bp_core_remove_subnav_item( $bp->blogs->slug, 'recent-posts' ); 220 bp_core_remove_subnav_item( $bp->blogs->slug, 'recent-comments' ); 221 } 222 add_action( 'init', 'bp_dtheme_remove_redundant' ); 223 204 /* Show a notice to the user in wp-admin when the theme is activated */ 224 205 function bp_dtheme_show_notice() { ?> 225 206 <div id="message" class="updated fade"> … … 230 211 <?php 231 212 } 213 if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) 214 add_action( 'admin_notices', 'bp_dtheme_show_notice' ); 232 215 233 216 /* Add words that we need to use in JS to the end of the page so they can be translated and still used. */ … … 241 224 var bp_terms_comments = '<?php _e( "comments", "buddypress" ) ?>'; 242 225 var bp_terms_close = '<?php _e( "Close", "buddypress" ) ?>'; 243 var bp_terms_mention_explain = '<?php printf( __( "%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_ dtheme_firstname(bp_get_displayed_user_fullname()), bp_dtheme_firstname(bp_get_displayed_user_fullname()) ); ?>';226 var bp_terms_mention_explain = '<?php printf( __( "%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()) ); ?>'; 244 227 </script> 245 228 <?php … … 247 230 add_action( 'wp_footer', 'bp_dtheme_js_terms' ); 248 231 249 250 /* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */251 if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {252 add_action( 'admin_notices', 'bp_dtheme_show_notice' );253 }254 255 256 232 ?>
Note: See TracChangeset
for help on using the changeset viewer.