Ticket #7729: 7729.01.patch
| File 7729.01.patch, 35.4 KB (added by , 8 years ago) |
|---|
-
src/bp-activity/classes/class-bp-activity-component.php
206 206 * @param array $sub_nav Optional. See BP_Component::setup_nav() for description. 207 207 */ 208 208 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 209 210 209 // Stop if there is no user displayed or logged in. 211 210 if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) { 212 211 return; 213 212 } 214 213 215 // Determine user to use.216 if ( bp_displayed_user_domain() ) {217 $user_domain = bp_displayed_user_domain();218 } elseif ( bp_loggedin_user_domain() ) {219 $user_domain = bp_loggedin_user_domain();220 } else {221 return;222 }223 224 214 $slug = bp_get_activity_slug(); 225 $activity_link = trailingslashit( $user_domain. $slug );215 $activity_link = trailingslashit( bp_displayed_user_domain() . $slug ); 226 216 227 217 // Add 'Activity' to the main navigation. 228 218 $main_nav = array( -
src/bp-blogs/classes/class-bp-blogs-component.php
203 203 return false; 204 204 } 205 205 206 // Determine user to use. 207 if ( bp_displayed_user_domain() ) { 208 $user_domain = bp_displayed_user_domain(); 209 } elseif ( bp_loggedin_user_domain() ) { 210 $user_domain = bp_loggedin_user_domain(); 211 } else { 206 // Bail if not on a user page. 207 if ( ! bp_is_user() ) { 212 208 return; 213 209 } 214 210 215 211 $slug = bp_get_blogs_slug(); 216 $parent_url = trailingslashit( $user_domain. $slug );212 $parent_url = trailingslashit( bp_displayed_user_domain() . $slug ); 217 213 218 214 // Add 'Sites' to the main navigation. 219 215 $count = (int) bp_get_total_blog_count_for_user(); -
src/bp-core/bp-core-adminbar.php
55 55 show_admin_bar( true ); 56 56 } 57 57 58 // Hide the WordPress Toolbar and show the BuddyBar.58 // Hide the WordPress Toolbar. 59 59 if ( ! bp_use_wp_admin_bar() ) { 60 _doing_it_wrong( __FUNCTION__, __( 'The BuddyBar is no longer supported. Please migrate to the WordPress toolbar as soon as possible.', 'buddypress' ), '2.1.0' );61 62 // Load deprecated code if not available.63 if ( ! function_exists( 'bp_core_admin_bar' ) ) {64 require buddypress()->plugin_dir . 'bp-core/deprecated/2.1.php';65 }66 67 60 // Keep the WP Toolbar from loading. 68 61 show_admin_bar( false ); 69 70 // Actions used to build the BP Toolbar.71 add_action( 'bp_adminbar_logo', 'bp_adminbar_logo' );72 add_action( 'bp_adminbar_menus', 'bp_adminbar_login_menu', 2 );73 add_action( 'bp_adminbar_menus', 'bp_adminbar_account_menu', 4 );74 add_action( 'bp_adminbar_menus', 'bp_adminbar_thisblog_menu', 6 );75 add_action( 'bp_adminbar_menus', 'bp_adminbar_random_menu', 100 );76 77 // Actions used to append BP Toolbar to footer.78 add_action( 'wp_footer', 'bp_core_admin_bar', 8 );79 add_action( 'admin_footer', 'bp_core_admin_bar' );80 62 } 81 63 } 82 64 add_action( 'init', 'bp_core_load_admin_bar', 9 ); -
deleted file src/bp-core/css/buddybar-rtl.css
deleted file mode 100644
+ - 1 body:not(.wp-admin) {2 padding-top: 25px !important;3 }4 5 #wp-admin-bar {6 position: fixed;7 top: 0;8 right: 0;9 height: 25px;10 font-size: 11px;11 width: 100%;12 z-index: 9999;13 }14 15 #wp-admin-bar .padder {16 position: relative;17 padding: 0;18 width: 100%;19 margin: 0 auto;20 background: url(../images/60pc_black.png);21 height: 25px;22 }23 24 body#bp-default #wp-admin-bar .padder {25 max-width: 1250px;26 }27 28 #wp-admin-bar * {29 z-index: 999;30 }31 32 #wp-admin-bar div#admin-bar-logo {33 position: absolute;34 top: 5px;35 right: 10px;36 }37 38 #wp-admin-bar a img {39 border: none;40 }41 42 #wp-admin-bar li {43 list-style: none;44 margin: 0;45 padding: 0;46 line-height: 1;47 text-align: right;48 }49 50 #wp-admin-bar li a {51 padding: 7px 15px;52 color: #eee;53 text-decoration: none;54 font-size: 11px;55 }56 57 #wp-admin-bar li.alt {58 border: none;59 }60 61 #wp-admin-bar li.no-arrow a {62 padding-left: 15px;63 }64 65 #wp-admin-bar ul li ul li a span {66 display: none;67 }68 69 #wp-admin-bar li:hover,70 #wp-admin-bar li.hover {71 position: static;72 }73 74 #admin-bar-logo {75 float: right;76 font-weight: 700;77 font-size: 11px;78 padding: 5px 8px;79 margin: 0;80 text-decoration: none;81 color: #fff;82 }83 84 body#bp-default #admin-bar-logo {85 padding: 2px 8px;86 }87 88 /* all lists */89 #wp-admin-bar ul {90 margin: 0;91 list-style: none;92 line-height: 1;93 cursor: pointer;94 height: auto;95 padding: 0;96 }97 98 /* all list items */99 #wp-admin-bar ul li {100 padding: 0;101 float: right;102 position: relative;103 background: url(../images/admin-menu-arrow.gif) 88% 53% no-repeat;104 padding-left: 11px;105 }106 107 #wp-admin-bar ul li.no-arrow {108 background: none;109 padding-left: 0;110 }111 112 #wp-admin-bar ul li ul li {113 background-image: none;114 }115 116 #wp-admin-bar ul li.align-right {117 position: absolute;118 left: 0;119 }120 121 #wp-admin-bar ul li a {122 display: block;123 }124 125 #wp-admin-bar ul.main-nav li:hover,126 #wp-admin-bar ul.main-nav li.sfhover,127 #wp-admin-bar ul.main-nav li ul li.sfhover {128 background-color: #333;129 }130 131 /* second-level lists */132 #wp-admin-bar ul li ul {133 position: absolute;134 width: 185px;135 right: -999em;136 margin-right: 0;137 background: #333;138 border: 1px solid #222;139 -moz-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);140 -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);141 -moz-border-radius: 3px;142 -webkit-border-radius: 3px;143 -moz-border-radius-topright: 0;144 -webkit-border-top-right-radius: 0;145 -moz-border-radius-topleft: 0;146 -webkit-border-top-left-radius: 0;147 }148 149 #wp-admin-bar ul li > ul {150 border-top: none;151 }152 153 #wp-admin-bar ul li ul a {154 color: #eee;155 }156 157 #wp-admin-bar ul li ul li {158 float: right;159 width: 174px;160 margin: 0;161 }162 163 #wp-admin-bar ul li ul li:hover a {164 color: #fff;165 }166 167 #wp-admin-bar ul li div.admin-bar-clear {168 clear: both;169 }170 171 #wp-admin-bar ul.main-nav li ul li:hover,172 #wp-admin-bar ul.main-nav li ul li.sfhover,173 #wp-admin-bar ul.main-nav li ul li.sfhover {174 background-color: #222;175 }176 177 /* third-and-above-level lists */178 #wp-admin-bar ul li ul ul {179 margin: -25px 184px 0 0;180 -moz-border-radius: 3px;181 -webkit-border-radius: 3px;182 }183 184 #wp-admin-bar ul li ul li:hover ul li a {185 color: #eee;186 }187 188 #wp-admin-bar ul li ul li ul li:hover a {189 color: #fff;190 }191 192 #wp-admin-bar ul li:hover ul,193 #wp-admin-bar ul li ul li:hover ul,194 #wp-admin-bar ul li.sfhover ul,195 #wp-admin-bar ul li ul li.sfhover ul {196 right: auto;197 }198 199 #wp-admin-bar ul li.align-right:hover ul {200 left: 0;201 }202 203 #wp-admin-bar ul li:hover ul ul,204 #wp-admin-bar li.sfhover ul li ul {205 right: -999em;206 }207 208 /* Menu item css */209 #wp-admin-bar img.avatar {210 float: right;211 margin-left: 8px;212 }213 214 #wp-admin-bar span.activity {215 display: block;216 margin-right: 34px;217 padding: 0;218 }219 220 #wp-admin-bar ul.author-list li a {221 height: 17px;222 }223 224 #wp-admin-bar ul li#bp-adminbar-notifications-menu a span {225 padding: 0 6px;226 margin-right: 2px;227 background: #fff;228 color: #000;229 -moz-border-radius: 3px;230 -webkit-border-radius: 3px;231 border-radius: 3px;232 }233 234 #wp-admin-bar-user-info img.avatar {235 height: 64px;236 width: 64px;237 } -
deleted file src/bp-core/css/buddybar.css
deleted file mode 100644
+ - 1 body:not(.wp-admin) {2 padding-top: 25px !important;3 }4 5 #wp-admin-bar {6 position: fixed;7 top: 0;8 left: 0;9 height: 25px;10 font-size: 11px;11 width: 100%;12 z-index: 9999;13 }14 15 #wp-admin-bar .padder {16 position: relative;17 padding: 0;18 width: 100%;19 margin: 0 auto;20 background: url(../images/60pc_black.png);21 height: 25px;22 }23 24 body#bp-default #wp-admin-bar .padder {25 max-width: 1250px;26 }27 28 #wp-admin-bar * {29 z-index: 999;30 }31 32 #wp-admin-bar div#admin-bar-logo {33 position: absolute;34 top: 5px;35 left: 10px;36 }37 38 #wp-admin-bar a img {39 border: none;40 }41 42 #wp-admin-bar li {43 list-style: none;44 margin: 0;45 padding: 0;46 line-height: 1;47 text-align: left;48 }49 50 #wp-admin-bar li a {51 padding: 7px 15px;52 color: #eee;53 text-decoration: none;54 font-size: 11px;55 }56 57 #wp-admin-bar li.alt {58 border: none;59 }60 61 #wp-admin-bar li.no-arrow a {62 padding-right: 15px;63 }64 65 #wp-admin-bar ul li ul li a span {66 display: none;67 }68 69 #wp-admin-bar li:hover,70 #wp-admin-bar li.hover {71 position: static;72 }73 74 #admin-bar-logo {75 float: left;76 font-weight: 700;77 font-size: 11px;78 padding: 5px 8px;79 margin: 0;80 text-decoration: none;81 color: #fff;82 }83 84 body#bp-default #admin-bar-logo {85 padding: 2px 8px;86 }87 88 /* all lists */89 #wp-admin-bar ul {90 margin: 0;91 list-style: none;92 line-height: 1;93 cursor: pointer;94 height: auto;95 padding: 0;96 }97 98 /* all list items */99 #wp-admin-bar ul li {100 padding: 0;101 float: left;102 position: relative;103 background: url(../images/admin-menu-arrow.gif) 88% 53% no-repeat;104 padding-right: 11px;105 }106 107 #wp-admin-bar ul li.no-arrow {108 background: none;109 padding-right: 0;110 }111 112 #wp-admin-bar ul li ul li {113 background-image: none;114 }115 116 #wp-admin-bar ul li.align-right {117 position: absolute;118 right: 0;119 }120 121 #wp-admin-bar ul li a {122 display: block;123 }124 125 #wp-admin-bar ul.main-nav li:hover,126 #wp-admin-bar ul.main-nav li.sfhover,127 #wp-admin-bar ul.main-nav li ul li.sfhover {128 background-color: #333;129 }130 131 /* second-level lists */132 #wp-admin-bar ul li ul {133 position: absolute;134 width: 185px;135 left: -999em;136 margin-left: 0;137 background: #333;138 border: 1px solid #222;139 -moz-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);140 -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);141 -moz-border-radius: 3px;142 -webkit-border-radius: 3px;143 -moz-border-radius-topleft: 0;144 -webkit-border-top-left-radius: 0;145 -moz-border-radius-topright: 0;146 -webkit-border-top-right-radius: 0;147 }148 149 #wp-admin-bar ul li > ul {150 border-top: none;151 }152 153 #wp-admin-bar ul li ul a {154 color: #eee;155 }156 157 #wp-admin-bar ul li ul li {158 float: left;159 width: 174px;160 margin: 0;161 }162 163 #wp-admin-bar ul li ul li:hover a {164 color: #fff;165 }166 167 #wp-admin-bar ul li div.admin-bar-clear {168 clear: both;169 }170 171 #wp-admin-bar ul.main-nav li ul li:hover,172 #wp-admin-bar ul.main-nav li ul li.sfhover,173 #wp-admin-bar ul.main-nav li ul li.sfhover {174 background-color: #222;175 }176 177 /* third-and-above-level lists */178 #wp-admin-bar ul li ul ul {179 margin: -25px 0 0 184px;180 -moz-border-radius: 3px;181 -webkit-border-radius: 3px;182 }183 184 #wp-admin-bar ul li ul li:hover ul li a {185 color: #eee;186 }187 188 #wp-admin-bar ul li ul li ul li:hover a {189 color: #fff;190 }191 192 #wp-admin-bar ul li:hover ul,193 #wp-admin-bar ul li ul li:hover ul,194 #wp-admin-bar ul li.sfhover ul,195 #wp-admin-bar ul li ul li.sfhover ul {196 left: auto;197 }198 199 #wp-admin-bar ul li.align-right:hover ul {200 right: 0;201 }202 203 #wp-admin-bar ul li:hover ul ul,204 #wp-admin-bar li.sfhover ul li ul {205 left: -999em;206 }207 208 /* Menu item css */209 #wp-admin-bar img.avatar {210 float: left;211 margin-right: 8px;212 }213 214 #wp-admin-bar span.activity {215 display: block;216 margin-left: 34px;217 padding: 0;218 }219 220 #wp-admin-bar ul.author-list li a {221 height: 17px;222 }223 224 #wp-admin-bar ul li#bp-adminbar-notifications-menu a span {225 padding: 0 6px;226 margin-left: 2px;227 background: #fff;228 color: #000;229 -moz-border-radius: 3px;230 -webkit-border-radius: 3px;231 border-radius: 3px;232 }233 234 #wp-admin-bar-user-info img.avatar {235 height: 64px;236 width: 64px;237 } -
src/bp-core/deprecated/2.1.php
39 39 * @return false|null Returns false on failure. Otherwise echoes the menu item. 40 40 */ 41 41 function bp_adminbar_blogs_menu() { 42 43 if ( ! is_user_logged_in() || ! bp_is_active( 'blogs' ) ) {44 return false;45 }46 47 if ( ! is_multisite() ) {48 return false;49 }50 51 $blogs = wp_cache_get( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', 'bp' );52 if ( empty( $blogs ) ) {53 $blogs = bp_blogs_get_blogs_for_user( bp_loggedin_user_id(), true );54 wp_cache_set( 'bp_blogs_of_user_' . bp_loggedin_user_id() . '_inc_hidden', $blogs, 'bp' );55 }56 57 $counter = 0;58 if ( is_array( $blogs['blogs'] ) && (int) $blogs['count'] ) {59 60 echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit( bp_loggedin_user_domain() . bp_get_blogs_slug() ) . '">';61 62 _e( 'My Sites', 'buddypress' );63 64 echo '</a>';65 echo '<ul>';66 67 foreach ( (array) $blogs['blogs'] as $blog ) {68 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';69 $site_url = esc_attr( $blog->siteurl );70 71 echo '<li' . $alt . '>';72 echo '<a href="' . $site_url . '">' . esc_html( $blog->name ) . '</a>';73 echo '<ul>';74 echo '<li class="alt"><a href="' . $site_url . 'wp-admin/">' . __( 'Dashboard', 'buddypress' ) . '</a></li>';75 echo '<li><a href="' . $site_url . 'wp-admin/post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';76 echo '<li class="alt"><a href="' . $site_url . 'wp-admin/edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';77 echo '<li><a href="' . $site_url . 'wp-admin/edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>';78 echo '</ul>';79 80 do_action( 'bp_adminbar_blog_items', $blog );81 82 echo '</li>';83 $counter++;84 }85 86 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';87 88 if ( bp_blog_signup_enabled() ) {89 echo '<li' . $alt . '>';90 echo '<a href="' . trailingslashit( bp_get_blogs_directory_permalink() . 'create' ) . '">' . __( 'Create a Site!', 'buddypress' ) . '</a>';91 echo '</li>';92 }93 94 echo '</ul>';95 echo '</li>';96 }97 42 } 98 43 99 44 /** … … 135 80 * @deprecated 2.1.0 136 81 */ 137 82 function bp_core_admin_bar() { 138 $bp = buddypress();139 140 if ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR ) {141 return false;142 }143 144 if ( (int) bp_get_option( 'hide-loggedout-adminbar' ) && !is_user_logged_in() ) {145 return false;146 }147 148 $bp->doing_admin_bar = true;149 150 echo '<div id="wp-admin-bar"><div class="padder">';151 152 // **** Do bp-adminbar-logo Actions ********153 do_action( 'bp_adminbar_logo' );154 155 echo '<ul class="main-nav">';156 157 // **** Do bp-adminbar-menus Actions ********158 do_action( 'bp_adminbar_menus' );159 160 echo '</ul>';161 echo "</div></div><!-- #wp-admin-bar -->\n\n";162 163 $bp->doing_admin_bar = false;164 83 } 165 84 166 85 /** … … 169 88 * @deprecated 2.1.0 170 89 */ 171 90 function bp_adminbar_logo() { 172 echo '<a href="' . bp_get_root_domain() . '" id="admin-bar-logo">' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . '</a>';173 91 } 174 92 175 93 /** … … 182 100 * @return false|null Returns false if the current user is logged in. 183 101 */ 184 102 function bp_adminbar_login_menu() { 185 186 if ( is_user_logged_in() ) {187 return false;188 }189 190 echo '<li class="bp-login no-arrow"><a href="' . wp_login_url() . '">' . __( 'Log In', 'buddypress' ) . '</a></li>';191 192 // Show "Sign Up" link if user registrations are allowed193 if ( bp_get_signup_allowed() ) {194 echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page() . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>';195 }196 103 } 197 104 198 105 /** … … 203 110 * @return false|null Returns false on failure. 204 111 */ 205 112 function bp_adminbar_account_menu() { 206 $bp = buddypress();207 208 if ( empty( $bp->bp_nav ) || ! is_user_logged_in() ) {209 return false;210 }211 212 echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">';213 echo __( 'My Account', 'buddypress' ) . '</a>';214 echo '<ul>';215 216 // Loop through each navigation item217 $counter = 0;218 foreach( (array) $bp->bp_nav as $nav_item ) {219 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';220 221 if ( -1 == $nav_item['position'] ) {222 continue;223 }224 225 echo '<li' . $alt . '>';226 echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>';227 228 if ( isset( $bp->bp_options_nav[$nav_item['slug']] ) && is_array( $bp->bp_options_nav[$nav_item['slug']] ) ) {229 echo '<ul>';230 $sub_counter = 0;231 232 foreach( (array) $bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) {233 $link = $subnav_item['link'];234 $name = $subnav_item['name'];235 236 if ( bp_displayed_user_domain() ) {237 $link = str_replace( bp_displayed_user_domain(), bp_loggedin_user_domain(), $subnav_item['link'] );238 }239 240 if ( isset( $bp->displayed_user->userdata->user_login ) ) {241 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] );242 }243 244 $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : '';245 echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>';246 $sub_counter++;247 }248 echo '</ul>';249 }250 251 echo '</li>';252 253 $counter++;254 }255 256 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';257 258 echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url( home_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';259 echo '</ul>';260 echo '</li>';261 113 } 262 114 263 115 function bp_adminbar_thisblog_menu() { 264 if ( current_user_can( 'edit_posts' ) ) {265 echo '<li id="bp-adminbar-thisblog-menu"><a href="' . admin_url() . '">';266 _e( 'Dashboard', 'buddypress' );267 echo '</a>';268 echo '<ul>';269 270 echo '<li class="alt"><a href="' . admin_url() . 'post-new.php">' . __( 'New Post', 'buddypress' ) . '</a></li>';271 echo '<li><a href="' . admin_url() . 'edit.php">' . __( 'Manage Posts', 'buddypress' ) . '</a></li>';272 echo '<li class="alt"><a href="' . admin_url() . 'edit-comments.php">' . __( 'Manage Comments', 'buddypress' ) . '</a></li>';273 274 do_action( 'bp_adminbar_thisblog_items' );275 276 echo '</ul>';277 echo '</li>';278 }279 116 } 280 117 281 118 /** … … 286 123 * @deprecated 2.1.0 287 124 */ 288 125 function bp_adminbar_random_menu() { 289 ?>290 291 <li class="align-right" id="bp-adminbar-visitrandom-menu">292 <a href="#"><?php _e( 'Visit', 'buddypress' ) ?></a>293 <ul class="random-list">294 <li><a href="<?php bp_members_directory_permalink(); ?>?random-member" rel="nofollow"><?php _e( 'Random Member', 'buddypress' ) ?></a></li>295 296 <?php if ( bp_is_active( 'groups' ) ) : ?>297 298 <li class="alt"><a href="<?php bp_groups_directory_permalink(); ?>?random-group" rel="nofollow"><?php _e( 'Random Group', 'buddypress' ) ?></a></li>299 300 <?php endif; ?>301 302 <?php if ( is_multisite() && bp_is_active( 'blogs' ) ) : ?>303 304 <li><a href="<?php bp_blogs_directory_permalink(); ?>?random-blog" rel="nofollow"><?php _e( 'Random Site', 'buddypress' ) ?></a></li>305 306 <?php endif; ?>307 308 <?php do_action( 'bp_adminbar_random_menu' ) ?>309 310 </ul>311 </li>312 313 <?php314 126 } 315 127 316 128 /** … … 319 131 * @deprecated 2.1.0 320 132 */ 321 133 function bp_core_load_buddybar_css() { 322 323 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 ) ) {324 return;325 }326 327 $min = bp_core_get_minified_asset_suffix();328 329 if ( file_exists( get_stylesheet_directory() . '/_inc/css/adminbar.css' ) ) { // Backwards compatibility330 $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css';331 } else {332 $stylesheet = buddypress()->plugin_url . "bp-core/css/buddybar{$min}.css";333 }334 335 wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_buddybar_rtl_css', $stylesheet ), array(), bp_get_version() );336 337 wp_style_add_data( 'bp-admin-bar', 'rtl', true );338 if ( $min ) {339 wp_style_add_data( 'bp-admin-bar', 'suffix', $min );340 }341 134 } 342 add_action( 'bp_init', 'bp_core_load_buddybar_css' );343 135 344 136 /** 345 137 * Add menu items to the BuddyBar. … … 349 141 * @deprecated 2.1.0 350 142 */ 351 143 function bp_groups_adminbar_admin_menu() { 352 $bp = buddypress();353 354 if ( empty( $bp->groups->current_group ) ) {355 return false;356 }357 358 // Only group admins and site admins can see this menu359 if ( !current_user_can( 'edit_users' ) && !bp_current_user_can( 'bp_moderate' ) && !bp_is_item_admin() ) {360 return false;361 } ?>362 363 <li id="bp-adminbar-adminoptions-menu">364 <a href="<?php bp_groups_action_link( 'admin' ); ?>"><?php _e( 'Admin Options', 'buddypress' ); ?></a>365 366 <ul>367 <li><a href="<?php bp_groups_action_link( 'admin/edit-details' ); ?>"><?php _e( 'Edit Details', 'buddypress' ); ?></a></li>368 369 <li><a href="<?php bp_groups_action_link( 'admin/group-settings' ); ?>"><?php _e( 'Group Settings', 'buddypress' ); ?></a></li>370 371 <?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) && $bp->avatar->show_avatars ) : ?>372 373 <li><a href="<?php bp_groups_action_link( 'admin/group-avatar' ); ?>"><?php _e( 'Group Profile Photo', 'buddypress' ); ?></a></li>374 375 <?php endif; ?>376 377 <?php if ( bp_is_active( 'friends' ) ) : ?>378 379 <li><a href="<?php bp_groups_action_link( 'send-invites' ); ?>"><?php _e( 'Manage Invitations', 'buddypress' ); ?></a></li>380 381 <?php endif; ?>382 383 <li><a href="<?php bp_groups_action_link( 'admin/manage-members' ); ?>"><?php _e( 'Manage Members', 'buddypress' ); ?></a></li>384 385 <?php if ( $bp->groups->current_group->status == 'private' ) : ?>386 387 <li><a href="<?php bp_groups_action_link( 'admin/membership-requests' ); ?>"><?php _e( 'Membership Requests', 'buddypress' ); ?></a></li>388 389 <?php endif; ?>390 391 <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>392 393 <?php do_action( 'bp_groups_adminbar_admin_menu' ) ?>394 395 </ul>396 </li>397 398 <?php399 144 } 400 add_action( 'bp_adminbar_menus', 'bp_groups_adminbar_admin_menu', 20 );401 145 402 146 /** 403 147 * Add the Notifications menu to the BuddyBar. … … 405 149 * @deprecated 2.1.0 406 150 */ 407 151 function bp_adminbar_notifications_menu() { 408 409 // Bail if notifications is not active410 if ( ! bp_is_active( 'notifications' ) ) {411 return false;412 }413 414 bp_notifications_buddybar_menu();415 152 } 416 add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );417 153 418 154 /** 419 155 * Add the Blog Authors menu to the BuddyBar (visible when not logged in). … … 421 157 * @deprecated 2.1.0 422 158 */ 423 159 function bp_adminbar_authors_menu() { 424 global $wpdb;425 426 // Only for multisite427 if ( ! is_multisite() ) {428 return false;429 }430 431 // Hide on root blog432 if ( bp_is_root_blog( $wpdb->blogid ) || ! bp_is_active( 'blogs' ) ) {433 return false;434 }435 436 $blog_prefix = $wpdb->get_blog_prefix( $wpdb->blogid );437 $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" );438 439 if ( !empty( $authors ) ) {440 // This is a blog, render a menu with links to all authors441 echo '<li id="bp-adminbar-authors-menu"><a href="/">';442 _e('Blog Authors', 'buddypress');443 echo '</a>';444 445 echo '<ul class="author-list">';446 foreach( (array) $authors as $author ) {447 $caps = maybe_unserialize( $author->caps );448 if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) {449 continue;450 }451 452 echo '<li>';453 echo '<a href="' . bp_core_get_user_domain( $author->user_id, $author->user_nicename, $author->user_login ) . '">';454 echo bp_core_fetch_avatar( array(455 'item_id' => $author->user_id,456 'email' => $author->user_email,457 'width' => 15,458 'height' => 15,459 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), $author->display_name )460 ) );461 echo ' ' . $author->display_name . '</a>';462 echo '<div class="admin-bar-clear"></div>';463 echo '</li>';464 }465 echo '</ul>';466 echo '</li>';467 }468 160 } 469 add_action( 'bp_adminbar_menus', 'bp_adminbar_authors_menu', 12 );470 161 471 162 /** 472 163 * Add a member admin menu to the BuddyBar. … … 477 168 * @deprecated 2.1.0 478 169 */ 479 170 function bp_members_adminbar_admin_menu() { 480 481 // Only show if viewing a user482 if ( ! bp_displayed_user_id() ) {483 return false;484 }485 486 // Don't show this menu to non site admins or if you're viewing your own profile487 if ( !current_user_can( 'edit_users' ) || bp_is_my_profile() ) {488 return false;489 } ?>490 491 <li id="bp-adminbar-adminoptions-menu">492 493 <a href=""><?php _e( 'Admin Options', 'buddypress' ) ?></a>494 495 <ul>496 <?php if ( bp_is_active( 'xprofile' ) ) : ?>497 498 <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>499 500 <?php endif ?>501 502 <li><a href="<?php bp_members_component_link( 'profile', 'change-avatar' ); ?>"><?php printf( __( "Edit %s's Profile Photo", 'buddypress' ), esc_attr( bp_get_displayed_user_fullname() ) ) ?></a></li>503 504 <li><a href="<?php bp_members_component_link( 'settings', 'capabilities' ); ?>"><?php _e( 'User Capabilities', 'buddypress' ); ?></a></li>505 506 <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>507 508 <?php do_action( 'bp_members_adminbar_admin_menu' ) ?>509 510 </ul>511 </li>512 513 <?php514 171 } 515 add_action( 'bp_adminbar_menus', 'bp_members_adminbar_admin_menu', 20 );516 172 517 173 /** 518 174 * Create the Notifications menu for the BuddyBar. … … 521 177 * @deprecated 2.1.0 522 178 */ 523 179 function bp_notifications_buddybar_menu() { 524 525 if ( ! is_user_logged_in() ) {526 return false;527 }528 529 echo '<li id="bp-adminbar-notifications-menu"><a href="' . esc_url( bp_loggedin_user_domain() ) . '">';530 _e( 'Notifications', 'buddypress' );531 532 $notification_count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );533 $notifications = bp_notifications_get_notifications_for_user( bp_loggedin_user_id() );534 535 if ( ! empty( $notification_count ) ) : ?>536 <span><?php echo bp_core_number_format( $notification_count ); ?></span>537 <?php538 endif;539 540 echo '</a>';541 echo '<ul>';542 543 if ( ! empty( $notifications ) ) {544 $counter = 0;545 for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {546 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>547 548 <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>549 550 <?php $counter++;551 }552 } else { ?>553 554 <li><a href="<?php echo esc_url( bp_loggedin_user_domain() ); ?>"><?php _e( 'No new notifications.', 'buddypress' ); ?></a></li>555 556 <?php557 }558 559 echo '</ul>';560 echo '</li>';561 180 } 562 add_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );563 181 564 182 /** 565 183 * Output the base URL for subdomain installations of WordPress Multisite. -
src/bp-friends/classes/class-bp-friends-component.php
157 157 * description. 158 158 */ 159 159 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 160 161 // Determine user to use. 162 if ( bp_displayed_user_domain() ) { 163 $user_domain = bp_displayed_user_domain(); 164 } elseif ( bp_loggedin_user_domain() ) { 165 $user_domain = bp_loggedin_user_domain(); 166 } else { 160 // Bail if not on a user page. 161 if ( ! bp_is_user() ) { 167 162 return; 168 163 } 169 164 170 165 $access = bp_core_can_edit_settings(); 171 166 $slug = bp_get_friends_slug(); 172 $friends_link = trailingslashit( $user_domain. $slug );167 $friends_link = trailingslashit( bp_displayed_user_domain() . $slug ); 173 168 174 169 // Add 'Friends' to the main navigation. 175 170 $count = friends_get_total_friend_count(); -
src/bp-groups/classes/class-bp-groups-component.php
517 517 * @param array $sub_nav Optional. See BP_Component::setup_nav() for description. 518 518 */ 519 519 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 520 521 // Determine user to use.522 if ( bp_displayed_user_domain() ) {523 $user_domain = bp_displayed_user_domain();524 } elseif ( bp_loggedin_user_domain() ) {525 $user_domain = bp_loggedin_user_domain();526 } else {527 $user_domain = false;528 }529 530 520 // Only grab count if we're on a user page. 531 521 if ( bp_is_user() ) { 532 522 $class = ( 0 === groups_total_groups_for_user( bp_displayed_user_id() ) ) ? 'no-count' : 'count'; … … 556 546 'item_css_id' => $this->id 557 547 ); 558 548 559 if ( ! empty( $user_domain ) ) { 549 // User profile nav. 550 if ( bp_is_user() ) { 560 551 $access = bp_core_can_edit_settings(); 561 $groups_link = trailingslashit( $user_domain. $slug );552 $groups_link = trailingslashit( bp_displayed_user_domain() . $slug ); 562 553 563 554 // Add the My Groups nav item. 564 555 $sub_nav[] = array( … … 585 576 parent::setup_nav( $main_nav, $sub_nav ); 586 577 } 587 578 579 // Single group nav. 588 580 if ( bp_is_groups_component() && bp_is_single_item() ) { 589 581 590 582 // Reset sub nav. -
src/bp-members/classes/class-bp-members-component.php
305 305 return; 306 306 } 307 307 308 // Determine user to use.309 if ( bp_displayed_user_domain() ) {310 $user_domain = bp_displayed_user_domain();311 } elseif ( bp_loggedin_user_domain() ) {312 $user_domain = bp_loggedin_user_domain();313 } else {314 return;315 }316 317 308 // Set slug to profile in case the xProfile component is not active 318 309 $slug = bp_get_profile_slug(); 319 310 … … 341 332 $this->sub_nav = array( 342 333 'name' => _x( 'View', 'Member profile view', 'buddypress' ), 343 334 'slug' => 'public', 344 'parent_url' => trailingslashit( $user_domain. $slug ),335 'parent_url' => trailingslashit( bp_displayed_user_domain() . $slug ), 345 336 'parent_slug' => $slug, 346 337 'screen_function' => 'bp_members_screen_display_profile', 347 338 'position' => 10 … … 365 356 $front_subnav['parent_slug'] = 'front'; 366 357 367 358 // In case the subnav is displayed in the front template 368 $front_subnav['parent_url'] = trailingslashit( $user_domain. 'front' );359 $front_subnav['parent_url'] = trailingslashit( bp_displayed_user_domain() . 'front' ); 369 360 370 361 // Set the subnav 371 362 $sub_nav[] = $front_subnav; -
src/bp-messages/classes/class-bp-messages-component.php
197 197 * @param array $sub_nav See {BP_Component::setup_nav()} for details. 198 198 */ 199 199 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 200 201 // Determine user to use. 202 if ( bp_displayed_user_domain() ) { 203 $user_domain = bp_displayed_user_domain(); 204 } elseif ( bp_loggedin_user_domain() ) { 205 $user_domain = bp_loggedin_user_domain(); 206 } else { 200 // Bail if not on a user page. 201 if ( ! bp_is_user() ) { 207 202 return; 208 203 } 209 204 210 205 $access = bp_core_can_edit_settings(); 211 206 $slug = bp_get_messages_slug(); 212 $messages_link = trailingslashit( $user_domain. $slug );207 $messages_link = trailingslashit( bp_displayed_user_domain() . $slug ); 213 208 214 209 // Only grab count if we're on a user page and current user has access. 215 210 if ( bp_is_user() && bp_user_has_access() ) { -
src/bp-notifications/classes/class-bp-notifications-component.php
139 139 * description. 140 140 */ 141 141 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 142 143 // Determine user to use. 144 if ( bp_displayed_user_domain() ) { 145 $user_domain = bp_displayed_user_domain(); 146 } elseif ( bp_loggedin_user_domain() ) { 147 $user_domain = bp_loggedin_user_domain(); 148 } else { 142 // Bail if not on a user page. 143 if ( ! bp_is_user() ) { 149 144 return; 150 145 } 151 146 152 147 $access = bp_core_can_edit_settings(); 153 148 $slug = bp_get_notifications_slug(); 154 $notifications_link = trailingslashit( $user_domain. $slug );149 $notifications_link = trailingslashit( bp_displayed_user_domain() . $slug ); 155 150 156 151 // Only grab count if we're on a user page and current user has access. 157 152 if ( bp_is_user() && bp_user_has_access() ) { -
src/bp-settings/classes/class-bp-settings-component.php
122 122 * @param array $sub_nav Array of sub nav items. 123 123 */ 124 124 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 125 126 // Determine user to use. 127 if ( bp_displayed_user_domain() ) { 128 $user_domain = bp_displayed_user_domain(); 129 } elseif ( bp_loggedin_user_domain() ) { 130 $user_domain = bp_loggedin_user_domain(); 131 } else { 125 // Bail if not on a user page. 126 if ( ! bp_is_user() ) { 132 127 return; 133 128 } 134 129 135 130 $access = bp_core_can_edit_settings(); 136 131 $slug = bp_get_settings_slug(); 137 $settings_link = trailingslashit( $user_domain. $slug );132 $settings_link = trailingslashit( bp_displayed_user_domain() . $slug ); 138 133 139 134 // Add the settings navigation item. 140 135 $main_nav = array( -
src/bp-xprofile/classes/class-bp-xprofile-component.php
233 233 * @param array $sub_nav Array of sub nav items to set up. 234 234 */ 235 235 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 236 237 // Determine user to use. 238 if ( bp_displayed_user_domain() ) { 239 $user_domain = bp_displayed_user_domain(); 240 } elseif ( bp_loggedin_user_domain() ) { 241 $user_domain = bp_loggedin_user_domain(); 242 } else { 236 // Bail if not on a user page. 237 if ( ! bp_is_user() ) { 243 238 return; 244 239 } 245 240 246 241 $access = bp_core_can_edit_settings(); 247 242 $slug = bp_get_profile_slug(); 248 $profile_link = trailingslashit( $user_domain. $slug );243 $profile_link = trailingslashit( bp_displayed_user_domain() . $slug ); 249 244 250 245 // Add 'Profile' to the main navigation. 251 246 $main_nav = array( … … 320 315 * @since 2.1.0 321 316 */ 322 317 public function setup_settings_nav() { 323 if ( ! bp_is_active( 'settings' ) ) { 324 return; 325 } 326 327 // Determine user to use. 328 if ( bp_displayed_user_domain() ) { 329 $user_domain = bp_displayed_user_domain(); 330 } elseif ( bp_loggedin_user_domain() ) { 331 $user_domain = bp_loggedin_user_domain(); 332 } else { 318 if ( ! bp_is_active( 'settings' ) || ! bp_is_user() ) { 333 319 return; 334 320 } 335 321 336 // Get the settings slug.337 $settings_slug = bp_get_settings_slug();338 339 322 bp_core_new_subnav_item( array( 340 323 'name' => _x( 'Profile Visibility', 'Profile settings sub nav', 'buddypress' ), 341 324 'slug' => 'profile', 342 'parent_url' => trailingslashit( $user_domain . $settings_slug),343 'parent_slug' => $settings_slug,325 'parent_url' => trailingslashit( bp_displayed_user_domain() . bp_get_settings_slug() ), 326 'parent_slug' => bp_get_settings_slug(), 344 327 'screen_function' => 'bp_xprofile_screen_settings', 345 328 'position' => 30, 346 329 'user_has_access' => bp_core_can_edit_settings()