Changeset 8568
- Timestamp:
- 07/09/2014 04:43:00 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 5 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-loader.php
r8508 r8568 94 94 'activity', 95 95 'functions', 96 'buddybar'97 96 ); 98 97 -
trunk/src/bp-core/admin/bp-core-settings.php
r7965 r8568 50 50 } 51 51 52 /**53 * If user has upgraded to 1.6 and chose to retain their BuddyBar, offer then a switch to change over54 * to the WP Toolbar.55 *56 * @since BuddyPress (1.6)57 */58 function bp_admin_setting_callback_force_buddybar() {59 ?>60 61 <input id="_bp_force_buddybar" name="_bp_force_buddybar" type="checkbox" value="1" <?php checked( ! bp_force_buddybar( true ) ); ?> />62 <label for="_bp_force_buddybar"><?php _e( 'Switch to WordPress Toolbar', 'buddypress' ); ?></label>63 64 <?php65 }66 67 52 /** Activity *******************************************************************/ 68 53 … … 116 101 117 102 <?php 118 }119 120 /**121 * Sanitization for _bp_force_buddyvar122 *123 * If upgraded to 1.6 and you chose to keep the BuddyBar, a checkbox asks if you want to switch to124 * the WP Toolbar. The option we store is 1 if the BuddyBar is forced on, so we use this function125 * to flip the boolean before saving the intval.126 *127 * @since BuddyPress (1.6)128 * @access Private129 */130 function bp_admin_sanitize_callback_force_buddybar( $value = false ) {131 return $value ? 0 : 1;132 103 } 133 104 -
trunk/src/bp-core/bp-core-adminbar.php
r7756 r8568 71 71 // Hide the WordPress Toolbar and show the BuddyBar 72 72 if ( ! bp_use_wp_admin_bar() ) { 73 _doing_it_wrong( __FUNCTION__, __( 'The BuddyBar is no longer supported. Please migrate to the WordPress toolbar as soon as possible.', 'buddypress' ), '2.1.0' ); 73 74 74 75 // Keep the WP Toolbar from loading -
trunk/src/bp-core/bp-core-buddybar.php
r8556 r8568 557 557 } 558 558 559 /** BuddyBar Template functions ***********************************************/560 561 /**562 * Wrapper function for rendering the BuddyBar.563 *564 * @return bool|null Returns false if the BuddyBar is disabled.565 */566 function bp_core_admin_bar() {567 global $bp;568 569 if ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR )570 return false;571 572 if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() )573 return false;574 575 $bp->doing_admin_bar = true;576 577 echo '<div id="wp-admin-bar"><div class="padder">';578 579 // **** Do bp-adminbar-logo Actions ********580 do_action( 'bp_adminbar_logo' );581 582 echo '<ul class="main-nav">';583 584 // **** Do bp-adminbar-menus Actions ********585 do_action( 'bp_adminbar_menus' );586 587 echo '</ul>';588 echo "</div></div><!-- #wp-admin-bar -->\n\n";589 590 $bp->doing_admin_bar = false;591 }592 593 /**594 * Output the BuddyBar logo.595 */596 function bp_adminbar_logo() {597 echo '<a href="' . bp_get_root_domain() . '" id="admin-bar-logo">' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . '</a>';598 }599 600 /**601 * Output the "Log In" and "Sign Up" names to the BuddyBar.602 *603 * Visible only to visitors who are not logged in.604 *605 * @return bool|null Returns false if the current user is logged in.606 */607 function bp_adminbar_login_menu() {608 609 if ( is_user_logged_in() )610 return false;611 612 echo '<li class="bp-login no-arrow"><a href="' . wp_login_url() . '">' . __( 'Log In', 'buddypress' ) . '</a></li>';613 614 // Show "Sign Up" link if user registrations are allowed615 if ( bp_get_signup_allowed() )616 echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page() . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>';617 }618 619 /**620 * Output the My Account BuddyBar menu.621 *622 * @return bool|null Returns false on failure.623 */624 function bp_adminbar_account_menu() {625 global $bp;626 627 if ( !$bp->bp_nav || !is_user_logged_in() )628 return false;629 630 echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">';631 echo __( 'My Account', 'buddypress' ) . '</a>';632 echo '<ul>';633 634 // Loop through each navigation item635 $counter = 0;636 foreach( (array) $bp->bp_nav as $nav_item ) {637 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';638 639 if ( -1 == $nav_item['position'] )640 continue;641 642 echo '<li' . $alt . '>';643 echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>';644 645 if ( isset( $bp->bp_options_nav[$nav_item['slug']] ) && is_array( $bp->bp_options_nav[$nav_item['slug']] ) ) {646 echo '<ul>';647 $sub_counter = 0;648 649 foreach( (array) $bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) {650 $link = $subnav_item['link'];651 $name = $subnav_item['name'];652 653 if ( bp_displayed_user_domain() )654 $link = str_replace( bp_displayed_user_domain(), bp_loggedin_user_domain(), $subnav_item['link'] );655 656 if ( isset( $bp->displayed_user->userdata->user_login ) )657 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] );658 659 $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : '';660 echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>';661 $sub_counter++;662 }663 echo '</ul>';664 }665 666 echo '</li>';667 668 $counter++;669 }670 671 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';672 673 echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url( home_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';674 echo '</ul>';675 echo '</li>';676 }677 678 function bp_adminbar_thisblog_menu() {679 if ( current_user_can( 'edit_posts' ) ) {680 echo '<li id="bp-adminbar-thisblog-menu"><a href="' . admin_url() . '">';681 _e( 'Dashboard', 'buddypress' );682 echo '</a>';683 echo '<ul>';684 685 echo '<li class="alt"><a href="' . admin_url() . 'post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';686 echo '<li><a href="' . admin_url() . 'edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';687 echo '<li class="alt"><a href="' . admin_url() . 'edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>';688 689 do_action( 'bp_adminbar_thisblog_items' );690 691 echo '</ul>';692 echo '</li>';693 }694 }695 696 /**697 * Output the Random BuddyBar menu.698 *699 * Not visible for logged-in users.700 */701 function bp_adminbar_random_menu() {702 ?>703 704 <li class="align-right" id="bp-adminbar-visitrandom-menu">705 <a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a>706 <ul class="random-list">707 <li><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ) . '?random-member' ?>" rel="nofollow"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>708 709 <?php if ( bp_is_active( 'groups' ) ) : ?>710 711 <li class="alt"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) . '?random-group' ?>" rel="nofollow"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>712 713 <?php endif; ?>714 715 <?php if ( is_multisite() && bp_is_active( 'blogs' ) ) : ?>716 717 <li><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() ) . '?random-blog' ?>" rel="nofollow"><?php _e( 'Random Site', 'buddypress' ) ?></a></li>718 719 <?php endif; ?>720 721 <?php do_action( 'bp_adminbar_random_menu' ) ?>722 723 </ul>724 </li>725 726 <?php727 }728 559 729 560 /** … … 748 579 return 'true' === $pref; 749 580 } 750 751 /**752 * Enqueue the BuddyBar CSS.753 */754 function bp_core_load_buddybar_css() {755 global $wp_styles;756 757 if ( bp_use_wp_admin_bar() || ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) || ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) )758 return;759 760 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';761 762 if ( file_exists( get_stylesheet_directory() . '/_inc/css/adminbar.css' ) ) { // Backwards compatibility763 $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css';764 } else {765 $stylesheet = buddypress()->plugin_url . "bp-core/css/buddybar{$min}.css";766 }767 768 wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_buddybar_rtl_css', $stylesheet ), array(), bp_get_version() );769 $wp_styles->add_data( 'bp-admin-bar', 'rtl', true );770 if ( $min )771 $wp_styles->add_data( 'bp-admin-bar', 'suffix', $min );772 }773 add_action( 'bp_init', 'bp_core_load_buddybar_css' ); -
trunk/src/bp-core/bp-core-options.php
r8553 r8568 519 519 function bp_restrict_group_creation( $default = true ) { 520 520 return (bool) apply_filters( 'bp_restrict_group_creation', (bool) bp_get_option( 'bp_restrict_group_creation', $default ) ); 521 }522 523 /**524 * Should the old BuddyBar be forced in place of the WP admin bar?525 *526 * @since BuddyPress (1.6.0)527 *528 * @uses bp_get_option() To get the BuddyBar option.529 *530 * @param bool $default Optional. Fallback value if not found in the database.531 * Default: true.532 * @return bool True if the BuddyBar should be forced on, otherwise false.533 */534 function bp_force_buddybar( $default = true ) {535 return (bool) apply_filters( 'bp_force_buddybar', (bool) bp_get_option( '_bp_force_buddybar', $default ) );536 521 } 537 522 -
trunk/src/bp-core/deprecated/2.1.php
r8559 r8568 19 19 $ext = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.js' : '.min.js'; 20 20 $url = buddypress()->plugin_url . 'bp-core/deprecated/js/'; 21 21 22 22 $scripts = apply_filters( 'bp_core_register_deprecated_scripts', array( 23 23 // Core … … 45 45 $ext = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.css' : '.min.css'; 46 46 $url = buddypress()->plugin_url . 'bp-core/deprecated/css/'; 47 47 48 48 $styles = apply_filters( 'bp_core_register_deprecated_styles', array( 49 49 // Messages … … 56 56 } 57 57 add_action( 'bp_enqueue_scripts', 'bp_core_register_deprecated_styles', 1 ); 58 59 /** BuddyBar *****************************************************************/ 60 61 /** 62 * Add a Sites menu to the BuddyBar. 63 * 64 * @since BuddyPress (1.0.0) 65 * @deprecated BuddyPress (2.1.0) 66 * 67 * @global object $bp The BuddyPress global settings object. 68 * 69 * @return bool|null Returns false on failure. Otherwise echoes the menu item. 70 */ 71 function bp_adminbar_blogs_menu() { 72 global $bp; 73 74 if ( !is_user_logged_in() || !bp_is_active( 'blogs' ) ) 75 return false; 76 77 if ( !is_multisite() ) 78 return false; 79 80 $blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp' ); 81 if ( empty( $blogs ) ) { 82 $blogs = bp_blogs_get_blogs_for_user( bp_loggedin_user_id(), true ); 83 wp_cache_set( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, 'bp' ); 84 } 85 86 $counter = 0; 87 if ( is_array( $blogs['blogs'] ) && (int) $blogs['count'] ) { 88 89 echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit( bp_loggedin_user_domain() . bp_get_blogs_slug() ) . '">'; 90 91 _e( 'My Sites', 'buddypress' ); 92 93 echo '</a>'; 94 echo '<ul>'; 95 96 foreach ( (array) $blogs['blogs'] as $blog ) { 97 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 98 $site_url = esc_attr( $blog->siteurl ); 99 100 echo '<li' . $alt . '>'; 101 echo '<a href="' . $site_url . '">' . esc_html( $blog->name ) . '</a>'; 102 echo '<ul>'; 103 echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __( 'Dashboard', 'buddypress' ) . '</a></li>'; 104 echo '<li><a href="' . $site_url . 'wp-admin/post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>'; 105 echo '<li class="alt"><a href="' . $site_url . 'wp-admin/edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>'; 106 echo '<li><a href="' . $site_url . 'wp-admin/edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>'; 107 echo '</ul>'; 108 109 do_action( 'bp_adminbar_blog_items', $blog ); 110 111 echo '</li>'; 112 $counter++; 113 } 114 115 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 116 117 if ( bp_blog_signup_enabled() ) { 118 echo '<li' . $alt . '>'; 119 echo '<a href="' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/">' . __( 'Create a Site!', 'buddypress' ) . '</a>'; 120 echo '</li>'; 121 } 122 123 echo '</ul>'; 124 echo '</li>'; 125 } 126 } 127 128 /** 129 * If user has upgraded to 1.6 and chose to retain their BuddyBar, offer then a switch to change over 130 * to the WP Toolbar. 131 * 132 * @since BuddyPress (1.6) 133 * @deprecated BuddyPress (2.1.0) 134 */ 135 function bp_admin_setting_callback_force_buddybar() { 136 ?> 137 138 <input id="_bp_force_buddybar" name="_bp_force_buddybar" type="checkbox" value="1" <?php checked( ! bp_force_buddybar( true ) ); ?> /> 139 <label for="_bp_force_buddybar"><?php _e( 'Switch to WordPress Toolbar', 'buddypress' ); ?></label> 140 141 <?php 142 } 143 144 145 /** 146 * Sanitization for _bp_force_buddyvar 147 * 148 * If upgraded to 1.6 and you chose to keep the BuddyBar, a checkbox asks if you want to switch to 149 * the WP Toolbar. The option we store is 1 if the BuddyBar is forced on, so we use this function 150 * to flip the boolean before saving the intval. 151 * 152 * @since BuddyPress (1.6) 153 * @deprecated BuddyPress (2.1.0) 154 * @access Private 155 */ 156 function bp_admin_sanitize_callback_force_buddybar( $value = false ) { 157 return $value ? 0 : 1; 158 } 159 160 /** 161 * Wrapper function for rendering the BuddyBar. 162 * 163 * @return bool|null Returns false if the BuddyBar is disabled. 164 * @deprecated BuddyPress (2.1.0) 165 */ 166 function bp_core_admin_bar() { 167 global $bp; 168 169 if ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) 170 return false; 171 172 if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) 173 return false; 174 175 $bp->doing_admin_bar = true; 176 177 echo '<div id="wp-admin-bar"><div class="padder">'; 178 179 // **** Do bp-adminbar-logo Actions ******** 180 do_action( 'bp_adminbar_logo' ); 181 182 echo '<ul class="main-nav">'; 183 184 // **** Do bp-adminbar-menus Actions ******** 185 do_action( 'bp_adminbar_menus' ); 186 187 echo '</ul>'; 188 echo "</div></div><!-- #wp-admin-bar -->\n\n"; 189 190 $bp->doing_admin_bar = false; 191 } 192 193 /** 194 * Output the BuddyBar logo. 195 * 196 * @deprecated BuddyPress (2.1.0) 197 */ 198 function bp_adminbar_logo() { 199 echo '<a href="' . bp_get_root_domain() . '" id="admin-bar-logo">' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . '</a>'; 200 } 201 202 /** 203 * Output the "Log In" and "Sign Up" names to the BuddyBar. 204 * 205 * Visible only to visitors who are not logged in. 206 * 207 * @deprecated BuddyPress (2.1.0) 208 * 209 * @return bool|null Returns false if the current user is logged in. 210 */ 211 function bp_adminbar_login_menu() { 212 213 if ( is_user_logged_in() ) 214 return false; 215 216 echo '<li class="bp-login no-arrow"><a href="' . wp_login_url() . '">' . __( 'Log In', 'buddypress' ) . '</a></li>'; 217 218 // Show "Sign Up" link if user registrations are allowed 219 if ( bp_get_signup_allowed() ) 220 echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page() . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>'; 221 } 222 223 /** 224 * Output the My Account BuddyBar menu. 225 * 226 * @deprecated BuddyPress (2.1.0) 227 * 228 * @return bool|null Returns false on failure. 229 */ 230 function bp_adminbar_account_menu() { 231 global $bp; 232 233 if ( !$bp->bp_nav || !is_user_logged_in() ) 234 return false; 235 236 echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">'; 237 echo __( 'My Account', 'buddypress' ) . '</a>'; 238 echo '<ul>'; 239 240 // Loop through each navigation item 241 $counter = 0; 242 foreach( (array) $bp->bp_nav as $nav_item ) { 243 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 244 245 if ( -1 == $nav_item['position'] ) 246 continue; 247 248 echo '<li' . $alt . '>'; 249 echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>'; 250 251 if ( isset( $bp->bp_options_nav[$nav_item['slug']] ) && is_array( $bp->bp_options_nav[$nav_item['slug']] ) ) { 252 echo '<ul>'; 253 $sub_counter = 0; 254 255 foreach( (array) $bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) { 256 $link = $subnav_item['link']; 257 $name = $subnav_item['name']; 258 259 if ( bp_displayed_user_domain() ) 260 $link = str_replace( bp_displayed_user_domain(), bp_loggedin_user_domain(), $subnav_item['link'] ); 261 262 if ( isset( $bp->displayed_user->userdata->user_login ) ) 263 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] ); 264 265 $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : ''; 266 echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>'; 267 $sub_counter++; 268 } 269 echo '</ul>'; 270 } 271 272 echo '</li>'; 273 274 $counter++; 275 } 276 277 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 278 279 echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url( home_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>'; 280 echo '</ul>'; 281 echo '</li>'; 282 } 283 284 function bp_adminbar_thisblog_menu() { 285 if ( current_user_can( 'edit_posts' ) ) { 286 echo '<li id="bp-adminbar-thisblog-menu"><a href="' . admin_url() . '">'; 287 _e( 'Dashboard', 'buddypress' ); 288 echo '</a>'; 289 echo '<ul>'; 290 291 echo '<li class="alt"><a href="' . admin_url() . 'post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>'; 292 echo '<li><a href="' . admin_url() . 'edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>'; 293 echo '<li class="alt"><a href="' . admin_url() . 'edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>'; 294 295 do_action( 'bp_adminbar_thisblog_items' ); 296 297 echo '</ul>'; 298 echo '</li>'; 299 } 300 } 301 302 /** 303 * Output the Random BuddyBar menu. 304 * 305 * Not visible for logged-in users. 306 * 307 * @deprecated BuddyPress (2.1.0) 308 */ 309 function bp_adminbar_random_menu() { 310 ?> 311 312 <li class="align-right" id="bp-adminbar-visitrandom-menu"> 313 <a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a> 314 <ul class="random-list"> 315 <li><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() ) . '?random-member' ?>" rel="nofollow"><?php _e( 'Random Member', 'buddypress' ) ?></a></li> 316 317 <?php if ( bp_is_active( 'groups' ) ) : ?> 318 319 <li class="alt"><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) . '?random-group' ?>" rel="nofollow"><?php _e( 'Random Group', 'buddypress' ) ?></a></li> 320 321 <?php endif; ?> 322 323 <?php if ( is_multisite() && bp_is_active( 'blogs' ) ) : ?> 324 325 <li><a href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_blogs_root_slug() ) . '?random-blog' ?>" rel="nofollow"><?php _e( 'Random Site', 'buddypress' ) ?></a></li> 326 327 <?php endif; ?> 328 329 <?php do_action( 'bp_adminbar_random_menu' ) ?> 330 331 </ul> 332 </li> 333 334 <?php 335 } 336 337 /** 338 * Enqueue the BuddyBar CSS. 339 * 340 * @deprecated BuddyPress (2.1.0) 341 */ 342 function bp_core_load_buddybar_css() { 343 global $wp_styles; 344 345 if ( bp_use_wp_admin_bar() || ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) || ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) ) 346 return; 347 348 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; 349 350 if ( file_exists( get_stylesheet_directory() . '/_inc/css/adminbar.css' ) ) { // Backwards compatibility 351 $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css'; 352 } else { 353 $stylesheet = buddypress()->plugin_url . "bp-core/css/buddybar{$min}.css"; 354 } 355 356 wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_buddybar_rtl_css', $stylesheet ), array(), bp_get_version() ); 357 $wp_styles->add_data( 'bp-admin-bar', 'rtl', true ); 358 if ( $min ) 359 $wp_styles->add_data( 'bp-admin-bar', 'suffix', $min ); 360 } 361 add_action( 'bp_init', 'bp_core_load_buddybar_css' ); 362 363 /** 364 * Should the old BuddyBar be forced in place of the WP admin bar? 365 * 366 * @since BuddyPress (1.6.0) 367 * @deprecated BuddyPress (2.1.0) 368 * 369 * @uses bp_get_option() To get the BuddyBar option. 370 * 371 * @param bool $default Optional. Fallback value if not found in the database. 372 * Default: true. 373 * @return bool True if the BuddyBar should be forced on, otherwise false. 374 */ 375 function bp_force_buddybar( $default = true ) { 376 return (bool) apply_filters( 'bp_force_buddybar', (bool) bp_get_option( '_bp_force_buddybar', $default ) ); 377 } 378 379 /** 380 * Add menu items to the BuddyBar. 381 * 382 * @since BuddyPress (1.0.0) 383 * 384 * @deprecated BuddyPress (2.1.0) 385 * 386 * @global BuddyPress $bp 387 */ 388 function bp_groups_adminbar_admin_menu() { 389 global $bp; 390 391 if ( empty( $bp->groups->current_group ) ) 392 return false; 393 394 // Only group admins and site admins can see this menu 395 if ( !current_user_can( 'edit_users' ) && !bp_current_user_can( 'bp_moderate' ) && !bp_is_item_admin() ) 396 return false; ?> 397 398 <li id="bp-adminbar-adminoptions-menu"> 399 <a href="<?php bp_groups_action_link( 'admin' ); ?>"><?php _e( 'Admin Options', 'buddypress' ); ?></a> 400 401 <ul> 402 <li><a href="<?php bp_groups_action_link( 'admin/edit-details' ); ?>"><?php _e( 'Edit Details', 'buddypress' ); ?></a></li> 403 404 <li><a href="<?php bp_groups_action_link( 'admin/group-settings' ); ?>"><?php _e( 'Group Settings', 'buddypress' ); ?></a></li> 405 406 <?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?> 407 408 <li><a href="<?php bp_groups_action_link( 'admin/group-avatar' ); ?>"><?php _e( 'Group Avatar', 'buddypress' ); ?></a></li> 409 410 <?php endif; ?> 411 412 <?php if ( bp_is_active( 'friends' ) ) : ?> 413 414 <li><a href="<?php bp_groups_action_link( 'send-invites' ); ?>"><?php _e( 'Manage Invitations', 'buddypress' ); ?></a></li> 415 416 <?php endif; ?> 417 418 <li><a href="<?php bp_groups_action_link( 'admin/manage-members' ); ?>"><?php _e( 'Manage Members', 'buddypress' ); ?></a></li> 419 420 <?php if ( $bp->groups->current_group->status == 'private' ) : ?> 421 422 <li><a href="<?php bp_groups_action_link( 'admin/membership-requests' ); ?>"><?php _e( 'Membership Requests', 'buddypress' ); ?></a></li> 423 424 <?php endif; ?> 425 426 <li><a class="confirm" href="<?php echo wp_nonce_url( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/delete-group/', 'groups_delete_group' ); ?>&delete-group-button=1&delete-group-understand=1"><?php _e( "Delete Group", 'buddypress' ) ?></a></li> 427 428 <?php do_action( 'bp_groups_adminbar_admin_menu' ) ?> 429 430 </ul> 431 </li> 432 433 <?php 434 } 435 add_action( 'bp_adminbar_menus', 'bp_groups_adminbar_admin_menu', 20 ); 436 437 /** 438 * Add the Notifications menu to the BuddyBar. 439 * 440 * @deprecated BuddyPress (2.1.0) 441 */ 442 function bp_adminbar_notifications_menu() { 443 444 // Bail if notifications is not active 445 if ( ! bp_is_active( 'notifications' ) ) { 446 return false; 447 } 448 449 bp_notifications_buddybar_menu(); 450 } 451 add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 ); 452 453 /** 454 * Add the Blog Authors menu to the BuddyBar (visible when not logged in). 455 * 456 * @deprecated BuddyPress (2.1.0) 457 */ 458 function bp_adminbar_authors_menu() { 459 global $wpdb; 460 461 // Only for multisite 462 if ( !is_multisite() ) 463 return false; 464 465 // Hide on root blog 466 if ( $wpdb->blogid == bp_get_root_blog_id() || !bp_is_active( 'blogs' ) ) 467 return false; 468 469 $blog_prefix = $wpdb->get_blog_prefix( $wpdb->blogid ); 470 $authors = $wpdb->get_results( "SELECT user_id, user_login, user_nicename, display_name, user_email, meta_value as caps FROM $wpdb->users u, $wpdb->usermeta um WHERE u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY um.user_id" ); 471 472 if ( !empty( $authors ) ) { 473 // This is a blog, render a menu with links to all authors 474 echo '<li id="bp-adminbar-authors-menu"><a href="/">'; 475 _e('Blog Authors', 'buddypress'); 476 echo '</a>'; 477 478 echo '<ul class="author-list">'; 479 foreach( (array) $authors as $author ) { 480 $caps = maybe_unserialize( $author->caps ); 481 if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) continue; 482 483 echo '<li>'; 484 echo '<a href="' . bp_core_get_user_domain( $author->user_id, $author->user_nicename, $author->user_login ) . '">'; 485 echo bp_core_fetch_avatar( array( 486 'item_id' => $author->user_id, 487 'email' => $author->user_email, 488 'width' => 15, 489 'height' => 15, 490 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), $author->display_name ) 491 ) ); 492 echo ' ' . $author->display_name . '</a>'; 493 echo '<div class="admin-bar-clear"></div>'; 494 echo '</li>'; 495 } 496 echo '</ul>'; 497 echo '</li>'; 498 } 499 } 500 add_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 ); 501 502 /** 503 * Add a member admin menu to the BuddyBar. 504 * 505 * Adds an Toolbar menu to any profile page providing site moderator actions 506 * that allow capable users to clean up a users account. 507 * 508 * @deprecated BuddyPress (2.1.0) 509 */ 510 function bp_members_adminbar_admin_menu() { 511 512 // Only show if viewing a user 513 if ( !bp_displayed_user_id() ) 514 return false; 515 516 // Don't show this menu to non site admins or if you're viewing your own profile 517 if ( !current_user_can( 'edit_users' ) || bp_is_my_profile() ) 518 return false; ?> 519 520 <li id="bp-adminbar-adminoptions-menu"> 521 522 <a href=""><?php _e( 'Admin Options', 'buddypress' ) ?></a> 523 524 <ul> 525 <?php if ( bp_is_active( 'xprofile' ) ) : ?> 526 527 <li><a href="<?php bp_members_component_link( 'profile', 'edit' ); ?>"><?php printf( __( "Edit %s's Profile", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ) ?></a></li> 528 529 <?php endif ?> 530 531 <li><a href="<?php bp_members_component_link( 'profile', 'change-avatar' ); ?>"><?php printf( __( "Edit %s's Avatar", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ) ?></a></li> 532 533 <li><a href="<?php bp_members_component_link( 'settings', 'capabilities' ); ?>"><?php _e( 'User Capabilities', 'buddypress' ); ?></a></li> 534 535 <li><a href="<?php bp_members_component_link( 'settings', 'delete-account' ); ?>"><?php printf( __( "Delete %s's Account", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ); ?></a></li> 536 537 <?php do_action( 'bp_members_adminbar_admin_menu' ) ?> 538 539 </ul> 540 </li> 541 542 <?php 543 } 544 add_action( 'bp_adminbar_menus', 'bp_members_adminbar_admin_menu', 20 ); 545 546 /** 547 * Create the Notifications menu for the BuddyBar. 548 * 549 * @since BuddyPress (1.9.0) 550 * @deprecated BuddyPress (2.1.0) 551 */ 552 function bp_notifications_buddybar_menu() { 553 554 if ( ! is_user_logged_in() ) { 555 return false; 556 } 557 558 echo '<li id="bp-adminbar-notifications-menu"><a href="' . esc_url( bp_loggedin_user_domain() ) . '">'; 559 _e( 'Notifications', 'buddypress' ); 560 561 if ( $notification_count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() ) ) : ?> 562 <span><?php echo bp_core_number_format( $notification_count ); ?></span> 563 <?php 564 endif; 565 566 echo '</a>'; 567 echo '<ul>'; 568 569 if ( $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id() ) ) { 570 $counter = 0; 571 for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) { 572 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?> 573 574 <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li> 575 576 <?php $counter++; 577 } 578 } else { ?> 579 580 <li><a href="<?php echo esc_url( bp_loggedin_user_domain() ); ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li> 581 582 <?php 583 } 584 585 echo '</ul>'; 586 echo '</li>'; 587 } 588 add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 ); -
trunk/src/bp-groups/bp-groups-loader.php
r8543 r8568 103 103 'activity', 104 104 'template', 105 'buddybar',106 105 'adminbar', 107 106 'functions', … … 351 350 352 351 /** 353 * Set up BuddyBar navigation352 * Set up navigation. 354 353 * 355 354 * @global BuddyPress $bp The one true BuddyPress instance -
trunk/src/bp-groups/bp-groups-notifications.php
r8097 r8568 310 310 311 311 /** 312 * Format the BuddyBar/Toolbar notifications for the Groups component312 * Format notifications for the Groups component. 313 313 * 314 314 * @since BuddyPress (1.0) -
trunk/src/bp-members/bp-members-loader.php
r8439 r8568 45 45 'screens', 46 46 'template', 47 'buddybar',48 47 'adminbar', 49 48 'functions', -
trunk/src/bp-messages/bp-messages-notifications.php
r8482 r8568 109 109 110 110 /** 111 * Format the BuddyBar/Toolbarnotifications for the Messages component.111 * Format notifications for the Messages component. 112 112 * 113 113 * @since BuddyPress (1.0.0) -
trunk/src/bp-notifications/bp-notifications-loader.php
r8223 r8568 47 47 'screens', 48 48 'adminbar', 49 'buddybar',50 49 'template', 51 50 'functions', -
trunk/src/bp-settings/bp-settings-loader.php
r7756 r8568 65 65 66 66 /** 67 * Set up BuddyBar navigation67 * Set up navigation. 68 68 */ 69 69 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { -
trunk/src/bp-xprofile/bp-xprofile-loader.php
r8518 r8568 64 64 'settings', 65 65 'template', 66 'buddybar',67 66 'functions', 68 67 ); … … 157 156 158 157 /** 159 * Set up BuddyBar navigation158 * Set up navigation. 160 159 * 161 160 * @global BuddyPress $bp The one true BuddyPress instance
Note: See TracChangeset
for help on using the changeset viewer.