Changeset 3311
- Timestamp:
- 06/12/2011 06:32:52 PM (14 years ago)
- Location:
- branches/plugin
- Files:
-
- 15 added
- 10 deleted
- 17 edited
-
bbp-admin/bbp-admin.php (modified) (1 diff)
-
bbp-includes/bbp-common-template.php (modified) (13 diffs)
-
bbp-includes/bbp-core-compatibility.php (modified) (28 diffs)
-
bbp-includes/bbp-core-hooks.php (modified) (4 diffs)
-
bbp-includes/bbp-core-shortcodes.php (modified) (13 diffs)
-
bbp-includes/bbp-topic-template.php (modified) (1 diff)
-
bbp-includes/bbp-user-template.php (modified) (3 diffs)
-
bbp-themes/bbp-twentyten/bbpress/action-edit.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/action-split-merge.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/content-single-forum.php (added)
-
bbp-themes/bbp-twentyten/bbpress/content-single-topic-lead.php (added)
-
bbp-themes/bbp-twentyten/bbpress/content-single-topic.php (added)
-
bbp-themes/bbp-twentyten/bbpress/content-single-user-edit.php (added)
-
bbp-themes/bbp-twentyten/bbpress/content-single-user.php (added)
-
bbp-themes/bbp-twentyten/bbpress/content-single-view.php (added)
-
bbp-themes/bbp-twentyten/bbpress/form-merge.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/form-reply.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/bbpress/form-split.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/form-topic-merge.php (added)
-
bbp-themes/bbp-twentyten/bbpress/form-topic-split.php (added)
-
bbp-themes/bbp-twentyten/bbpress/form-topic.php (modified) (1 diff)
-
bbp-themes/bbp-twentyten/bbpress/loop-forums.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/bbpress/loop-replies.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/bbpress/loop-topics.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/bbpress/pagination-replies.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/bbpress/pagination-topics.php (modified) (2 diffs)
-
bbp-themes/bbp-twentyten/bbpress/single-forum.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/single-topic.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/single-user.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/user-edit.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/user.php (deleted)
-
bbp-themes/bbp-twentyten/bbpress/view.php (deleted)
-
bbp-themes/bbp-twentyten/functions.php (modified) (4 diffs)
-
bbp-themes/bbp-twentyten/single-forum.php (modified) (1 diff)
-
bbp-themes/bbp-twentyten/single-reply-edit.php (added)
-
bbp-themes/bbp-twentyten/single-topic-edit.php (added)
-
bbp-themes/bbp-twentyten/single-topic-merge.php (added)
-
bbp-themes/bbp-twentyten/single-topic-split.php (added)
-
bbp-themes/bbp-twentyten/single-topic.php (modified) (1 diff)
-
bbp-themes/bbp-twentyten/single-user-edit.php (added)
-
bbp-themes/bbp-twentyten/single-user.php (added)
-
bbp-themes/bbp-twentyten/single-view.php (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-admin.php
r3288 r3311 348 348 349 349 // Set $bbp->theme_compat to true to bypass nag 350 if ( !empty( $bbp->theme_compat ) && !current_theme_supports( 'bbpress' ) ) { ?>350 if ( !empty( $bbp->theme_compat->theme ) && !current_theme_supports( 'bbpress' ) ) { ?> 351 351 352 352 <div id="message" class="updated fade"> -
branches/plugin/bbp-includes/bbp-common-template.php
r3309 r3311 203 203 204 204 /** 205 * Check if the current page is a topic tag 206 * 207 * @since bbPress (r3311) 208 * 209 * @global bbPress $bbp 210 * @return bool True if it's a topic tag, false if not 211 */ 212 function bbp_is_topic_tag() { 213 global $bbp; 214 215 if ( is_tax( $bbp->topic_tag_id ) ) 216 return true; 217 218 return false; 219 } 220 221 /** 222 * Check if the current post type is one of bbPress's 223 * 224 * @since bbPress (r3311) 225 * 226 * @uses get_post_type() 227 * @uses bbp_get_forum_post_type() 228 * @uses bbp_get_topic_post_type() 229 * @uses bbp_get_reply_post_type() 230 * 231 * @return bool 232 */ 233 function bbp_is_custom_post_type() { 234 235 // Current post type 236 $post_type = get_post_type(); 237 238 // bbPress post types 239 $bbp_post_types = array( 240 bbp_get_forum_post_type(), 241 bbp_get_topic_post_type(), 242 bbp_get_reply_post_type() 243 ); 244 245 // Viewing one of the bbPress post types 246 if ( in_array( $post_type, $bbp_post_types ) ) 247 return true; 248 249 return false; 250 } 251 252 /** 205 253 * Check if current page is a bbPress reply 206 254 * … … 325 373 * @since bbPress (r2688) 326 374 * 327 * @uses WP_Query Checks if WP_Query::bbp_is_ user_profile_pageis set to true375 * @uses WP_Query Checks if WP_Query::bbp_is_single_user is set to true 328 376 * @return bool True if it's a user's profile page, false if not 329 377 */ 330 function bbp_is_ user_profile_page() {378 function bbp_is_single_user() { 331 379 global $wp_query; 332 380 333 if ( !empty( $wp_query->bbp_is_ user_profile_page ) && ( true == $wp_query->bbp_is_user_profile_page) )381 if ( !empty( $wp_query->bbp_is_single_user ) && ( true == $wp_query->bbp_is_single_user ) ) 334 382 return true; 335 383 … … 342 390 * @since bbPress (r2688) 343 391 * 344 * @uses WP_Query Checks if WP_Query::bbp_is_ user_profile_edit is set to true392 * @uses WP_Query Checks if WP_Query::bbp_is_single_user_edit is set to true 345 393 * @return bool True if it's a user's profile edit page, false if not 346 394 */ 347 function bbp_is_ user_profile_edit() {395 function bbp_is_single_user_edit() { 348 396 global $wp_query; 349 397 350 if ( !empty( $wp_query->bbp_is_ user_profile_edit ) && ( true == $wp_query->bbp_is_user_profile_edit ) )398 if ( !empty( $wp_query->bbp_is_single_user_edit ) && ( true == $wp_query->bbp_is_single_user_edit ) ) 351 399 return true; 352 400 … … 362 410 * @return bool Is it a view page? 363 411 */ 364 function bbp_is_ view() {412 function bbp_is_single_view() { 365 413 global $wp_query; 366 414 … … 386 434 * @uses bbp_is_reply_edit() 387 435 * @uses bbp_is_reply_edit() 388 * @uses bbp_is_ view()389 * @uses bbp_is_ user_profile_edit()390 * @uses bbp_is_ user_profile_page()436 * @uses bbp_is_single_view() 437 * @uses bbp_is_single_user_edit() 438 * @uses bbp_is_single_user() 391 439 * @uses bbp_is_user_home() 392 440 * @uses bbp_is_subscriptions() … … 430 478 $bbp_classes[] = bbp_get_reply_post_type() . '-edit'; 431 479 432 if ( bbp_is_ view() )480 if ( bbp_is_single_view() ) 433 481 $bbp_classes[] = 'bbp-view'; 434 482 435 483 /** User ******************************************************************/ 436 484 437 if ( bbp_is_ user_profile_edit() ) {485 if ( bbp_is_single_user_edit() ) { 438 486 $bbp_classes[] = 'bbp-user-edit'; 439 487 $bbp_classes[] = 'single'; … … 441 489 } 442 490 443 if ( bbp_is_ user_profile_page() ) {491 if ( bbp_is_single_user() ) { 444 492 $bbp_classes[] = 'bbp-user-page'; 445 493 $bbp_classes[] = 'single'; … … 1262 1310 1263 1311 // View 1264 elseif ( bbp_is_ view() )1312 elseif ( bbp_is_single_view() ) 1265 1313 $pre_current_text = bbp_get_view_title(); 1266 1314 … … 1528 1576 * various items within the page title. 1529 1577 * @param string $seplocation Optional. Direction to display title, 'right'. 1530 * @uses bbp_is_ user_profile_page() To check if it's a user profile page1531 * @uses bbp_is_ user_profile_edit() To check if it's a user profile edit page1578 * @uses bbp_is_single_user() To check if it's a user profile page 1579 * @uses bbp_is_single_user_edit() To check if it's a user profile edit page 1532 1580 * @uses bbp_is_user_home() To check if the profile page is of the current user 1533 1581 * @uses get_query_var() To get the user id … … 1541 1589 * @uses is_tax() To check if it's the tag page 1542 1590 * @uses get_queried_object() To get the queried object 1543 * @uses bbp_is_ view() To check if it's a view1591 * @uses bbp_is_single_view() To check if it's a view 1544 1592 * @uses bbp_get_view_title() To get the view title 1545 1593 * @uses apply_filters() Calls 'bbp_raw_title' with the title … … 1586 1634 1587 1635 // Profile page 1588 } elseif ( bbp_is_ user_profile_page() ) {1636 } elseif ( bbp_is_single_user() ) { 1589 1637 1590 1638 // Current users profile … … 1599 1647 1600 1648 // Profile edit page 1601 } elseif ( bbp_is_ user_profile_edit() ) {1649 } elseif ( bbp_is_single_user_edit() ) { 1602 1650 1603 1651 // Current users profile … … 1614 1662 1615 1663 // Views 1616 } elseif ( bbp_is_ view() ) {1664 } elseif ( bbp_is_single_view() ) { 1617 1665 $title = sprintf( __( 'View: %s', 'bbpress' ), bbp_get_view_title() ); 1618 1666 } -
branches/plugin/bbp-includes/bbp-core-compatibility.php
r3309 r3311 24 24 25 25 /** 26 * Set the theme compat theme URL and DIR 27 * 28 * @since bbPress (r3311) 29 * 30 * @global bbPress $bbp 31 * @param string $theme 32 * @uses current_theme_supports() 33 */ 34 function bbp_theme_compat_set_theme( $theme = array() ) { 35 36 // Check if current theme supports bbPress 37 if ( empty( $bbp->theme_compat->theme ) && !current_theme_supports( 'bbpress' ) ) { 38 39 global $bbp; 40 41 if ( empty( $theme ) ) { 42 $theme = array( 43 'dir' => $bbp->themes_dir . '/bbp-twentyten', 44 'url' => $bbp->themes_url . '/bbp-twentyten' 45 ); 46 } 47 48 // Set the theme compat globals for help with loading template parts 49 $bbp->theme_compat->theme = $theme; 50 } 51 } 52 53 /** 26 54 * If not using a bbPress compatable theme, enqueue some basic styling and js 27 55 * … … 29 57 * 30 58 * @global bbPress $bbp 31 * @uses bbp_set_ theme_compat() Set the compatable theme to bbp-twentyten59 * @uses bbp_set_compat_theme_dir() Set the compatable theme to bbp-twentyten 32 60 * @uses current_theme_supports() Check bbPress theme support 33 61 * @uses wp_enqueue_style() Enqueue the bbp-twentyten default CSS 34 62 * @uses wp_enqueue_script() Enqueue the bbp-twentyten default topic JS 35 63 */ 36 function bbp_ add_theme_compat() {64 function bbp_theme_compat_enqueue_css() { 37 65 global $bbp; 38 66 … … 40 68 if ( !current_theme_supports( 'bbpress' ) ) { 41 69 42 // Set the compat_theme global for help with loading template parts43 bbp_set_theme_compat( $bbp->themes_dir . '/bbp-twentyten' );44 45 70 /** Default CSS ***************************************************/ 46 71 … … 50 75 // Right to left 51 76 if ( is_rtl() ) { 52 wp_enqueue_style( 'bbpress-style', $bbp->themes_url . '/bbp-twentyten/css/bbpress-rtl.css' );77 wp_enqueue_style( 'bbpress-style', bbp_get_theme_compat_url() . '/css/bbpress-rtl.css' ); 53 78 54 79 // Left to right 55 80 } else { 56 wp_enqueue_style( 'bbpress-style', $bbp->themes_url . '/bbp-twentyten/css/bbpress.css' );81 wp_enqueue_style( 'bbpress-style', bbp_get_theme_compat_url() . '/css/bbpress.css' ); 57 82 } 58 83 } … … 83 108 // lifting to see if a bbPress template is needed in the current context 84 109 if ( !current_theme_supports( 'bbpress' ) ) 85 load_template( bbp_get_theme_compat () . '/' . $slug . '-' . $name . '.php', false );110 load_template( bbp_get_theme_compat_dir() . '/' . $slug . '-' . $name . '.php', false ); 86 111 87 112 // Current theme supports bbPress to proceed as usual … … 103 128 * @return string 104 129 */ 105 function bbp_get_theme_compat () {130 function bbp_get_theme_compat_dir() { 106 131 global $bbp; 107 132 108 return apply_filters( 'bbp_get_theme_compat ', $bbp->theme_compat);109 } 110 111 /** 112 * Sets the bbPress compatable theme used in the event the currently active133 return apply_filters( 'bbp_get_theme_compat_dir', $bbp->theme_compat->theme['dir'] ); 134 } 135 136 /** 137 * Gets the bbPress compatable theme used in the event the currently active 113 138 * WordPress theme does not explicitly support bbPress. This can be filtered, 114 139 * or set manually. Tricky theme authors can override the default and include … … 118 143 * 119 144 * @global bbPress $bbp 120 * @param string $theme Optional. Must be full absolute path to theme121 145 * @uses apply_filters() 122 146 * @return string 123 147 */ 124 function bbp_ set_theme_compat( $theme = '') {148 function bbp_get_theme_compat_url() { 125 149 global $bbp; 126 150 127 // Set theme to bundled bbp-twentyten if nothing is passed 128 if ( empty( $theme ) && !empty( $bbp->themes_dir ) ) 129 $bbp->theme_compat = $bbp->themes_dir . '/bbp-twentyten'; 130 131 // Set to what is passed 132 else 133 $bbp->theme_compat = $theme; 134 135 return apply_filters( 'bbp_get_theme_compat', $bbp->theme_compat ); 151 return apply_filters( 'bbp_get_theme_compat_url', $bbp->theme_compat->theme['url'] ); 136 152 } 137 153 … … 145 161 * @return bool 146 162 */ 147 function bbp_i n_theme_compat() {163 function bbp_is_theme_compat_active() { 148 164 global $bbp; 149 165 150 return $bbp->in_theme_compat; 166 if ( empty( $bbp->theme_compat->active ) ) 167 return false; 168 169 return $bbp->theme_compat->active; 151 170 } 152 171 … … 162 181 * @return bool 163 182 */ 164 function bbp_set_ in_theme_compat( $set = true ) {183 function bbp_set_theme_compat_active( $set = true ) { 165 184 global $bbp; 166 185 167 $bbp->in_theme_compat = $set; 168 169 return (bool) $bbp->in_theme_compat; 186 $bbp->theme_compat->active = $set; 187 188 return (bool) $bbp->theme_compat->active; 189 } 190 191 /** 192 * Set the theme compat templates global 193 * 194 * Stash possible template files for the current query. Useful if plugins want 195 * to override them, or see what files are being scanned for inclusion. 196 * 197 * @since bbPress (r3311) 198 * 199 * @global $bbp; 200 */ 201 function bbp_set_theme_compat_templates( $templates = array() ) { 202 global $bbp; 203 204 $bbp->theme_compat->templates = $templates; 205 206 return $bbp->theme_compat->templates; 207 } 208 209 /** 210 * Set the theme compat template global 211 * 212 * Stash the template file for the current query. Useful if plugins want 213 * to override it, or see what file is being included. 214 * 215 * @since bbPress (r3311) 216 * 217 * @global $bbp; 218 */ 219 function bbp_set_theme_compat_template( $template = '' ) { 220 global $bbp; 221 222 $bbp->theme_compat->template = $template; 223 224 return $bbp->theme_compat->template; 170 225 } 171 226 … … 235 290 $wp_query->is_archive = false; 236 291 $wp_query->is_tax = false; 237 }238 239 /**240 * Used to guess if page exists at requested path241 *242 * @since bbPress (r3304)243 *244 * @uses get_option() To see if pretty permalinks are enabled245 * @uses get_page_by_path() To see if page exists at path246 *247 * @param string $path248 * @return mixed False if no page, Page object if true249 */250 function bbp_get_page_by_path( $path = '' ) {251 292 252 // Default to false 253 $retval = false; 254 255 // Path is not empty 256 if ( !empty( $path ) ) { 257 258 // Pretty permalinks are on so path might exist 259 if ( get_option( 'permalink_structure' ) ) { 260 $retval = get_page_by_path( $path ); 261 } 262 } 263 264 return apply_filters( 'bbp_get_page_by_path', $retval, $path ); 265 } 266 267 /** Filters *******************************************************************/ 268 269 /** 270 * Removes all filters from a WordPress filter, and stashes them in the $bbp 271 * global in the event they need to be restored later. 272 * 273 * @since bbPress (r3251) 274 * 275 * @global bbPress $bbp 276 * @global WP_filter $wp_filter 277 * @global array $merged_filters 278 * 279 * @param string $tag 280 * @param int $priority 281 * 282 * @return bool 283 */ 284 function bbp_remove_all_filters( $tag, $priority = false ) { 285 global $bbp, $wp_filter, $merged_filters; 286 287 // Filters exist 288 if ( isset( $wp_filter[$tag] ) ) { 289 290 // Filters exist in this priority 291 if ( !empty( $priority ) && isset( $wp_filter[$tag][$priority] ) ) { 292 293 // Store filters in a backup 294 $bbp->filters->wp_filter[$tag][$priority] = $wp_filter[$tag][$priority]; 295 296 // Unset the filters 297 unset( $wp_filter[$tag][$priority] ); 298 299 // Priority is empty 300 } else { 301 302 // Store filters in a backup 303 $bbp->filters->wp_filter[$tag] = $wp_filter[$tag]; 304 305 // Unset the filters 306 unset( $wp_filter[$tag] ); 307 } 308 } 309 310 // Check merged filters 311 if ( isset( $merged_filters[$tag] ) ) { 312 313 // Store filters in a backup 314 $bbp->filters->merged_filters[$tag] = $merged_filters[$tag]; 315 316 // Unset the filters 317 unset( $merged_filters[$tag] ); 318 } 319 320 return true; 321 } 322 323 /** 324 * Restores filters from the $bbp global that were removed using 325 * bbp_remove_all_filters() 326 * 327 * @since bbPress (r3251) 328 * 329 * @global bbPress $bbp 330 * @global WP_filter $wp_filter 331 * @global array $merged_filters 332 * 333 * @param string $tag 334 * @param int $priority 335 * 336 * @return bool 337 */ 338 function bbp_restore_all_filters( $tag, $priority = false ) { 339 global $bbp, $wp_filter, $merged_filters; 293 // If we are resetting a post, we are in theme compat 294 bbp_set_theme_compat_active(); 295 } 296 297 /** Templates *****************************************************************/ 298 299 /** 300 * Get the user profile template 301 * 302 * @since bbPress (r3311) 303 * 304 * @uses bbp_get_displayed_user_id() 305 * @uses apply_filters() 306 * 307 * @return array 308 */ 309 function bbp_get_single_user_template() { 310 311 $displayed = bbp_get_displayed_user_id(); 312 $templates = array( 313 314 // Single User ID 315 'single-user-' . $displayed . '.php', 316 'bbpress/single-user-' . $displayed . '.php', 317 'forums/single-user-' . $displayed . '.php', 318 319 // Single User 320 'single-user.php', 321 'bbpress/single-user.php', 322 'forums/single-user.php', 323 324 // User 325 'user.php', 326 'bbpress/user.php', 327 'forums/user.php', 328 ); 329 330 $templates = apply_filters( 'bbp_get_profile_template', $templates ); 331 $templates = bbp_set_theme_compat_templates( $templates ); 332 333 $template = locate_template( $templates, false, false ); 334 $template = bbp_set_theme_compat_template( $template ); 335 336 return $template; 337 } 338 339 /** 340 * Get the user profile edit template 341 * 342 * @since bbPress (r3311) 343 * 344 * @uses $displayed 345 * @uses apply_filters() 346 * 347 * @return array 348 */ 349 function bbp_get_single_user_edit_template() { 350 351 $displayed = bbp_get_displayed_user_id(); 352 $templates = array( 353 354 // Single User Edit ID 355 'single-user-edit-' . $displayed . '.php', 356 'bbpress/single-user-edit-' . $displayed . '.php', 357 'forums/single-user-edit-' . $displayed . '.php', 358 359 // Single User Edit 360 'single-user-edit.php', 361 'bbpress/single-user-edit.php', 362 'forums/single-user-edit.php', 363 364 // User Edit 365 'user-edit.php', 366 'bbpress/user-edit.php', 367 'forums/user-edit.php', 368 369 // User 370 'forums/user.php', 371 'bbpress/user.php', 372 'user.php', 373 ); 374 375 $templates = apply_filters( 'bbp_get_profile_edit_template', $templates ); 376 $templates = bbp_set_theme_compat_templates( $templates ); 377 378 $template = locate_template( $templates, false, false ); 379 $template = bbp_set_theme_compat_template( $template ); 380 381 return $template; 382 } 383 384 /** 385 * Get the view template 386 * 387 * @since bbPress (r3311) 388 * 389 * @uses bbp_get_view_id() 390 * @uses apply_filters() 391 * 392 * @return array 393 */ 394 function bbp_get_single_view_template() { 395 396 $view_id = bbp_get_view_id(); 397 $templates = array( 398 399 // Single View ID 400 'single-view-' . $view_id . '.php', 401 'bbpress/single-view-' . $view_id . '.php', 402 'forums/single-view-' . $view_id . '.php', 403 404 // View ID 405 'view-' . $view_id . '.php', 406 'bbpress/view-' . $view_id . '.php', 407 'forums/view-' . $view_id . '.php', 408 409 // Single View 410 'single-view.php', 411 'bbpress/single-view.php', 412 'forums/single-view.php', 413 414 // View 415 'view.php', 416 'bbpress/view.php', 417 'forums/view.php', 418 ); 419 420 $templates = apply_filters( 'bbp_get_single_view_template', $templates ); 421 $templates = bbp_set_theme_compat_templates( $templates ); 422 423 $template = locate_template( $templates, false, false ); 424 $template = bbp_set_theme_compat_template( $template ); 425 426 return $template; 427 } 428 429 /** 430 * Get the topic edit template 431 * 432 * @since bbPress (r3311) 433 * 434 * @uses bbp_get_topic_post_type() 435 * @uses apply_filters() 436 * 437 * @return array 438 */ 439 function bbp_get_topic_edit_template() { 440 441 $post_type = bbp_get_topic_post_type(); 442 $templates = array( 443 444 // Single Topic Edit 445 'single-' . $post_type . '-edit.php', 446 'bbpress/single-' . $post_type . '-edit.php', 447 'forums/single-' . $post_type . '-edit.php', 448 449 // Single Action Edit Topic 450 'single-action-edit-' . $post_type . '.php', 451 'bbpress/single-action-edit-' . $post_type . '.php', 452 'forums/single-action-edit-' . $post_type . '.php', 453 454 // Single Action Edit 455 'single-action-edit.php', 456 'bbpress/single-action-edit.php', 457 'forums/single-action-edit.php', 458 459 // Action Edit 460 'action-edit.php', 461 'bbpress/action-edit.php', 462 'forums/action-edit.php', 463 464 // Single Topic 465 'single-' . $post_type . '.php', 466 'forums/single-' . $post_type . '.php', 467 'bbpress/single-' . $post_type . '.php', 468 ); 469 470 $templates = apply_filters( 'bbp_get_topic_edit_template', $templates ); 471 $templates = bbp_set_theme_compat_templates( $templates ); 472 473 $template = locate_template( $templates, false, false ); 474 $template = bbp_set_theme_compat_template( $template ); 475 476 return $template; 477 } 478 479 /** 480 * Get the topic split template 481 * 482 * @since bbPress (r3311) 483 * 484 * @uses bbp_get_topic_post_type() 485 * @uses apply_filters() 486 * 487 * @return array 488 */ 489 function bbp_get_topic_split_template() { 490 491 $post_type = bbp_get_topic_post_type(); 492 $templates = array( 493 494 // Topic Split Split 495 'single-' . $post_type . '-split.php', 496 'bbpress/single-' . $post_type . '-split.php', 497 'forums/single-' . $post_type . '-split.php', 498 499 // Action Split Split 500 'single-action-split-merge.php', 501 'bbpress/single-action-split-merge.php', 502 'forums/single-action-split-merge.php', 503 504 // Action Split Split 505 'action-split-merge.php', 506 'bbpress/action-split-merge.php', 507 'forums/action-split-merge.php' 508 ); 509 510 $templates = apply_filters( 'bbp_get_topic_edit_template', $templates ); 511 $templates = bbp_set_theme_compat_templates( $templates ); 512 513 $template = locate_template( $templates, false, false ); 514 $template = bbp_set_theme_compat_template( $template ); 515 516 return $template; 517 } 518 519 /** 520 * Get the topic merge template 521 * 522 * @since bbPress (r3311) 523 * 524 * @uses bbp_get_topic_post_type() 525 * @uses apply_filters() 526 * 527 * @return array 528 */ 529 function bbp_get_topic_merge_template() { 530 531 $post_type = bbp_get_topic_post_type(); 532 $templates = array( 533 534 // Topic Split Merge 535 'single-' . $post_type . '-merge.php', 536 'bbpress/single-' . $post_type . '-merge.php', 537 'forums/single-' . $post_type . '-merge.php', 538 539 // Action Split Merge 540 'single-action-split-merge.php', 541 'bbpress/single-action-split-merge.php', 542 'forums/single-action-split-merge.php', 543 544 // Action Split Merge 545 'action-split-merge.php', 546 'bbpress/action-split-merge.php', 547 'forums/action-split-merge.php' 548 ); 549 550 $templates = apply_filters( 'bbp_get_topic_edit_template', $templates ); 551 $templates = bbp_set_theme_compat_templates( $templates ); 552 553 $template = locate_template( $templates, false, false ); 554 $template = bbp_set_theme_compat_template( $template ); 555 556 return $template; 557 } 558 559 /** 560 * Get the reply edit template 561 * 562 * @since bbPress (r3311) 563 * 564 * @uses bbp_get_reply_post_type() 565 * @uses apply_filters() 566 * 567 * @return array 568 */ 569 function bbp_get_reply_edit_template() { 570 571 $post_type = bbp_get_reply_post_type(); 572 $templates = array( 573 574 // Single Reply Edit 575 'single-' . $post_type . '-edit.php', 576 'bbpress/single-' . $post_type . '-edit.php', 577 'forums/single-' . $post_type . '-edit.php', 578 579 // Single Action Edit Reply 580 'single-action-edit-' . $post_type . '.php', 581 'bbpress/single-action-edit-' . $post_type . '.php', 582 'forums/single-action-edit-' . $post_type . '.php', 583 584 // Single Action Edit 585 'single-action-edit.php', 586 'bbpress/single-action-edit.php', 587 'forums/single-action-edit.php', 588 589 // Action Edit 590 'action-edit.php', 591 'bbpress/action-edit.php', 592 'forums/action-edit.php', 593 594 // Single Reply 595 'single-' . $post_type . '.php', 596 'forums/single-' . $post_type . '.php', 597 'bbpress/single-' . $post_type . '.php', 598 ); 599 600 $templates = apply_filters( 'bbp_get_reply_edit_template', $templates ); 601 $templates = bbp_set_theme_compat_templates( $templates ); 340 602 341 // Filters exist 342 if ( isset( $bbp->filters->wp_filter[$tag] ) ) { 343 344 // Filters exist in this priority 345 if ( !empty( $priority ) && isset( $bbp->filters->wp_filter[$tag][$priority] ) ) { 346 347 // Store filters in a backup 348 $wp_filter[$tag][$priority] = $bbp->filters->wp_filter[$tag][$priority]; 349 350 // Unset the filters 351 unset( $bbp->filters->wp_filter[$tag][$priority] ); 352 353 // Priority is empty 354 } else { 355 356 // Store filters in a backup 357 $wp_filter[$tag] = $bbp->filters->wp_filter[$tag]; 358 359 // Unset the filters 360 unset( $bbp->filters->wp_filter[$tag] ); 361 } 362 } 363 364 // Check merged filters 365 if ( isset( $bbp->filters->merged_filters[$tag] ) ) { 366 367 // Store filters in a backup 368 $merged_filters[$tag] = $bbp->filters->merged_filters[$tag]; 369 370 // Unset the filters 371 unset( $bbp->filters->merged_filters[$tag] ); 372 } 373 374 return true; 375 } 376 377 /** 378 * Add checks for view page, user page, user edit, topic edit and reply edit 379 * pages. 380 * 381 * If it's a user page, WP_Query::bbp_is_user_profile_page is set to true. 382 * If it's a user edit page, WP_Query::bbp_is_user_profile_edit is set to true 383 * and the the 'wp-admin/includes/user.php' file is included. 384 * In addition, on user/user edit pages, WP_Query::home is set to false & query 385 * vars 'bbp_user_id' with the displayed user id and 'author_name' with the 386 * displayed user's nicename are added. 387 * 388 * If it's a topic edit, WP_Query::bbp_is_topic_edit is set to true and 389 * similarly, if it's a reply edit, WP_Query::bbp_is_reply_edit is set to true. 390 * 391 * If it's a view page, WP_Query::bbp_is_view is set to true 392 * 393 * @since bbPress (r2688) 394 * 395 * @uses get_query_var() To get {@link WP_Query} query var 396 * @uses is_email() To check if the string is an email 397 * @uses get_user_by() To try to get the user by email and nicename 398 * @uses WP_User to get the user data 399 * @uses WP_Query::set_404() To set a 404 status 400 * @uses current_user_can() To check if the current user can edit the user 401 * @uses apply_filters() Calls 'enable_edit_any_user_configuration' with true 402 * @uses wp_die() To die 403 * @uses bbp_is_query_name() Check if query name is 'bbp_widget' 404 * @uses bbp_get_view_query_args() To get the view query args 405 * @uses bbp_get_topic_post_type() To get the topic post type 406 * @uses bbp_get_reply_post_type() To get the reply post type 407 * @uses is_multisite() To check if it's a multisite 408 * @uses remove_action() To remove the auto save post revision action 409 */ 410 function bbp_pre_get_posts( $posts_query ) { 411 global $bbp; 412 413 // Bail if $posts_query is not an object or of incorrect class 414 if ( !is_object( $posts_query ) || ( 'WP_Query' != get_class( $posts_query ) ) ) 415 return $posts_query; 416 417 // Bail if filters are suppressed on this query 418 if ( true == $posts_query->get( 'suppress_filters' ) ) 419 return $posts_query; 420 421 // Get query variables 422 $bbp_user = $posts_query->get( $bbp->user_id ); 423 $bbp_view = $posts_query->get( $bbp->view_id ); 424 $is_edit = $posts_query->get( $bbp->edit_id ); 425 426 // It is a user page - We'll also check if it is user edit 427 if ( !empty( $bbp_user ) ) { 428 429 // Not a user_id so try email and slug 430 if ( !is_numeric( $bbp_user ) ) { 431 432 // Email was passed 433 if ( is_email( $bbp_user ) ) 434 $bbp_user = get_user_by( 'email', $bbp_user ); 435 // Try nicename 436 else 437 $bbp_user = get_user_by( 'slug', $bbp_user ); 438 439 // If we were successful, set to ID 440 if ( is_object( $bbp_user ) ) 441 $bbp_user = $bbp_user->ID; 442 } 443 444 // Create new user 445 $user = new WP_User( $bbp_user ); 446 447 // Stop if no user 448 if ( !isset( $user ) || empty( $user ) || empty( $user->ID ) ) { 449 $posts_query->set_404(); 450 return; 451 } 452 453 /** User Exists *******************************************************/ 454 455 // View or edit? 456 if ( !empty( $is_edit ) ) { 457 458 // Only allow super admins on multisite to edit every user. 459 if ( ( is_multisite() && !current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) ) 460 wp_die( __( 'You do not have the permission to edit this user.', 'bbpress' ) ); 461 462 // We are editing a profile 463 $posts_query->bbp_is_user_profile_edit = true; 464 465 // Load the core WordPress contact methods 466 if ( !function_exists( '_wp_get_user_contactmethods' ) ) 467 include_once( ABSPATH . 'wp-includes/registration.php' ); 468 469 // Load the edit_user functions 470 if ( !function_exists( 'edit_user' ) ) 471 require_once( ABSPATH . 'wp-admin/includes/user.php' ); 472 473 // We are viewing a profile 474 } else { 475 $posts_query->bbp_is_user_profile_page = true; 476 } 477 478 // Make sure 404 is not set 479 $posts_query->is_404 = false; 480 481 // Correct is_home variable 482 $posts_query->is_home = false; 483 484 // Set bbp_user_id for future reference 485 $posts_query->query_vars['bbp_user_id'] = $user->ID; 486 487 // Set author_name as current user's nicename to get correct posts 488 if ( !bbp_is_query_name( 'bbp_widget' ) ) 489 $posts_query->query_vars['author_name'] = $user->user_nicename; 490 491 // Set the displayed user global to this user 492 $bbp->displayed_user = $user; 493 494 // View Page 495 } elseif ( !empty( $bbp_view ) ) { 496 497 // Check if the view exists by checking if there are query args are set 498 $view_args = bbp_get_view_query_args( $bbp_view ); 499 500 // Stop if view args is false - means the view isn't registered 501 if ( false === $view_args ) { 502 $posts_query->set_404(); 503 return; 504 } 505 506 // Correct is_home variable 507 $posts_query->is_home = false; 508 509 // We are in a custom topic view 510 $posts_query->bbp_is_view = true; 511 512 // Topic/Reply Edit Page 513 } elseif ( !empty( $is_edit ) ) { 514 515 // We are editing a topic 516 if ( $posts_query->get( 'post_type' ) == bbp_get_topic_post_type() ) 517 $posts_query->bbp_is_topic_edit = true; 518 519 // We are editing a reply 520 elseif ( $posts_query->get( 'post_type' ) == bbp_get_reply_post_type() ) 521 $posts_query->bbp_is_reply_edit = true; 522 523 // We save post revisions on our own 524 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 525 } 526 527 return $posts_query; 603 $template = locate_template( $templates, false, false ); 604 $template = bbp_set_theme_compat_template( $template ); 605 606 return $template; 607 } 608 609 /** 610 * Get the files to fallback on to use for theme compatibility 611 * 612 * @since bbPress (r3311) 613 * 614 * @uses apply_filters() 615 * @uses bbp_set_theme_compat_templates(); 616 * 617 * @return type 618 */ 619 function bbp_get_theme_compat_templates() { 620 621 $templates = array( 622 'bbpress.php', 623 'forum.php', 624 'page.php', 625 'single.php', 626 'index.php' 627 ); 628 629 $templates = apply_filters( 'bbp_get_theme_compat_templates', $templates ); 630 $templates = bbp_set_theme_compat_templates( $templates ); 631 632 $template = locate_template( $templates, false, false ); 633 $template = bbp_set_theme_compat_template( $template ); 634 635 return $template; 528 636 } 529 637 … … 534 642 * to appear. If the current theme does not explicitly support bbPress, it 535 643 * intercepts the page template and uses one served from the bbPress compatable 536 * theme, set asthe $bbp->theme_compat global. If the current theme does644 * theme, set in the $bbp->theme_compat global. If the current theme does 537 645 * support bbPress, we'll explore the template hierarchy and try to locate one. 538 646 * … … 541 649 * @global bbPress $bbp 542 650 * @global WP_Query $post 651 * 543 652 * @param string $template 544 * @return string 545 */ 546 function bbp_template_include( $template = false ) { 653 * 654 * @uses current_theme_supports() To check if theme supports bbPress 655 * @uses bbp_is_single_user() To check if page is single user 656 * @uses bbp_get_single_user_template() To get user template 657 * @uses bbp_is_single_user_edit() To check if page is single user edit 658 * @uses bbp_get_single_user_edit_template() To get user edit template 659 * @uses bbp_is_single_view() To check if page is single view 660 * @uses bbp_get_single_view_template() To get view template 661 * @uses bbp_is_topic_merge() To check if page is topic merge 662 * @uses bbp_get_topic_merge_template() To get topic merge template 663 * @uses bbp_is_topic_split() To check if page is topic split 664 * @uses bbp_get_topic_split_template() To get topic split template 665 * @uses bbp_is_topic_edit() To check if page is topic edit 666 * @uses bbp_get_topic_edit_template() To get topic edit template 667 * @uses bbp_is_reply_edit() To check if page is reply edit 668 * @uses bbp_get_reply_edit_template() To get reply edit template 669 * @uses bbp_set_theme_compat_template() To set the global theme compat template 670 * 671 * @return string The path to the template file that is being used 672 */ 673 function bbp_template_include_theme_supports( $template = '' ) { 547 674 global $bbp; 548 549 // Define local variable(s)550 $templates = array();551 $new_template = '';552 675 553 676 // Current theme supports bbPress 554 677 if ( current_theme_supports( 'bbpress' ) ) { 555 678 556 // Viewing a profile 557 if ( bbp_is_user_profile_page() ) { 558 $templates = apply_filters( 'bbp_profile_templates', array( 559 'forums/user.php', 560 'bbpress/user.php', 561 'user.php', 562 'author.php', 563 'index.php' 564 ) ); 565 566 // Editing a profile 567 } elseif ( bbp_is_user_profile_edit() ) { 568 $templates = apply_filters( 'bbp_profile_edit_templates', array( 569 'forums/user-edit.php', 570 'bbpress/user-edit.php', 571 'user-edit.php', 572 'forums/user.php', 573 'bbpress/user.php', 574 'user.php', 575 'author.php', 576 'index.php' 577 ) ); 578 579 // View page 580 } elseif ( bbp_is_view() ) { 581 $templates = apply_filters( 'bbp_view_templates', array( 582 'forums/view-' . bbp_get_view_id(), 583 'bbpress/view-' . bbp_get_view_id(), 584 'forums/view.php', 585 'bbpress/view.php', 586 'view-' . bbp_get_view_id(), 587 'view.php', 588 'index.php' 589 ) ); 590 591 // Editing a topic 592 } elseif ( bbp_is_topic_edit() ) { 593 $templates = array( 594 'forums/action-edit.php', 595 'bbpress/action-edit.php', 596 'forums/single-' . bbp_get_topic_post_type(), 597 'bbpress/single-' . bbp_get_topic_post_type(), 598 'action-bbp-edit.php', 599 'single-' . bbp_get_topic_post_type(), 600 'single.php', 601 'index.php' 602 ); 603 604 // Add split/merge to front of array if present in _GET 605 if ( !empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'merge', 'split' ) ) ) { 606 array_unshift( $templates, 607 'forums/action-split-merge.php', 608 'bbpress/action-split-merge.php', 609 'action-split-merge.php' 610 ); 611 } 612 613 $templates = apply_filters( 'bbp_topic_edit_templates', $templates ); 679 // Viewing a user 680 if ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) : 681 682 // Editing a user 683 elseif ( bbp_is_single_user_edit() && ( $new_template = bbp_get_single_user_edit_template() ) ) : 684 685 // Single View 686 elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) : 687 688 // Topic merge 689 elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) : 690 691 // Topic split 692 elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) : 693 694 // Topic edit 695 elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) : 614 696 615 697 // Editing a reply 616 } elseif ( bbp_is_reply_edit() ) { 617 $templates = apply_filters( 'bbp_reply_edit_templates', array( 618 'forums/action-edit.php', 619 'bbpress/action-edit.php', 620 'forums/single-' . bbp_get_reply_post_type(), 621 'bbpress/single-' . bbp_get_reply_post_type(), 622 'action-bbp-edit.php', 623 'single-' . bbp_get_reply_post_type(), 624 'single.php', 625 'index.php' 626 ) ); 627 } 698 elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) : 699 endif; 628 700 629 701 // Custom template file exists 630 if ( !empty( $templates ) && ( $new_template = locate_template( $templates, false, false ) ) ) { 631 $template = $new_template; 632 } 702 $template = !empty( $new_template ) ? $new_template : $template; 633 703 } 634 704 635 /** 636 * In this next bit, either the current theme does not support bbPress, or 637 * the theme author has incorrectly used add_theme_support( 'bbpress' ) 638 * and we are going to help them out by silently filling in the blanks. 639 */ 640 if ( !current_theme_supports( 'bbpress' ) || ( !empty( $templates ) && empty( $new_template ) ) ) { 641 642 // Assume we are not in theme compat 643 $forum_id = 0; 705 return apply_filters( 'bbp_template_include_theme_supports', $template ); 706 } 707 708 /** 709 * In this next bit, either the current theme does not support bbPress, or 710 * the theme author has incorrectly used add_theme_support( 'bbpress' ) 711 * and we are going to help them out by silently filling in the blanks. 712 */ 713 function bbp_template_include_theme_compat( $template = '' ) { 714 global $bbp; 715 716 if ( !current_theme_supports( 'bbpress' ) || ( !empty( $bbp->theme_compat->templates ) && empty( $bbp->theme_compat->template ) ) ) { 644 717 645 718 /** Users *************************************************************/ 646 719 647 if ( bbp_is_user_profile_page() || bbp_is_user_profile_edit() ) { 648 649 // In Theme Compat 650 bbp_set_in_theme_compat(); 720 if ( bbp_is_single_user() || bbp_is_single_user_edit() ) { 651 721 652 722 // Reset post … … 659 729 // Forum archive 660 730 } elseif ( bbp_is_forum_archive() ) { 661 662 // In Theme Compat663 bbp_set_in_theme_compat();664 731 665 732 // Reset post … … 679 746 } elseif ( bbp_is_topic_archive() ) { 680 747 681 // In Theme Compat682 bbp_set_in_theme_compat();683 684 748 // Reset post 685 749 bbp_theme_compat_reset_post( array( … … 696 760 } elseif ( bbp_is_topic_edit() || bbp_is_topic_split() || bbp_is_topic_merge() ) { 697 761 698 // In Theme Compat699 bbp_set_in_theme_compat();700 701 762 // Reset post 702 763 bbp_theme_compat_reset_post( array( … … 715 776 } elseif ( is_post_type_archive( bbp_get_reply_post_type() ) ) { 716 777 717 // In Theme Compat718 bbp_set_in_theme_compat();719 720 778 // Reset post 721 779 bbp_theme_compat_reset_post( array( … … 732 790 } elseif ( bbp_is_reply_edit() ) { 733 791 734 // In Theme Compat735 bbp_set_in_theme_compat();736 737 792 // Reset post 738 793 bbp_theme_compat_reset_post( array( … … 748 803 /** Views *************************************************************/ 749 804 750 } elseif ( bbp_is_view() ) { 751 752 // In Theme Compat 753 bbp_set_in_theme_compat(); 805 } elseif ( bbp_is_single_view() ) { 754 806 755 807 // Reset post … … 767 819 /** Topic Tags ********************************************************/ 768 820 769 } elseif ( is_tax( $bbp->topic_tag_id ) ) { 770 771 // In Theme Compat 772 bbp_set_in_theme_compat(); 821 } elseif ( bbp_is_topic_tag() ) { 773 822 774 823 // Stash the current term in a new var … … 782 831 /** Single Forums/Topics/Replies **************************************/ 783 832 784 } else { 785 786 // Are we looking at a forum/topic/reply? 787 switch ( get_post_type() ) { 788 789 // Single Forum 790 case bbp_get_forum_post_type() : 791 bbp_set_in_theme_compat(); 792 $forum_id = bbp_get_forum_id( get_the_ID() ); 793 break; 794 795 // Single Topic 796 case bbp_get_topic_post_type() : 797 bbp_set_in_theme_compat(); 798 $forum_id = bbp_get_topic_forum_id( get_the_ID() ); 799 break; 800 801 // Single Reply 802 case bbp_get_reply_post_type() : 803 bbp_set_in_theme_compat(); 804 $forum_id = bbp_get_reply_forum_id( get_the_ID() ); 805 break; 806 } 833 } elseif ( bbp_is_custom_post_type() ) { 834 bbp_set_theme_compat_active(); 807 835 } 808 836 … … 822 850 * the 'bbp_template_include' filter to override page.php. 823 851 */ 824 if ( bbp_i n_theme_compat() ) {852 if ( bbp_is_theme_compat_active() ) { 825 853 826 854 // Remove all filters from the_content … … 830 858 add_filter( 'the_content', 'bbp_replace_the_content' ); 831 859 832 // Allow just-in-time filtering of theme compat template833 $templates = apply_filters( 'bbp_template_include', array(834 'bbpress.php',835 'forum.php',836 'page.php',837 'single.php',838 'index.php'839 ) );840 841 860 // Find the appropriate template file 842 $template = locate_template( $templates, false, false);861 $template = bbp_get_theme_compat_templates(); 843 862 } 844 863 } 845 864 846 // Return $template 847 return $template; 865 return apply_filters( 'bbp_template_include_theme_compat', $template ); 848 866 } 849 867 … … 885 903 886 904 // Profile View 887 if ( bbp_is_ user_profile_page() ) {905 if ( bbp_is_single_user() ) { 888 906 ob_start(); 889 907 890 bbp_get_template_part( 'bbpress/ single', 'user');908 bbp_get_template_part( 'bbpress/content', 'single-user' ); 891 909 892 910 $new_content = ob_get_contents(); … … 895 913 896 914 // Profile Edit 897 } elseif ( bbp_is_ user_profile_edit() ) {915 } elseif ( bbp_is_single_user_edit() ) { 898 916 ob_start(); 899 917 900 bbp_get_template_part( 'bbpress/ single', 'user');918 bbp_get_template_part( 'bbpress/content', 'single-user-edit' ); 901 919 902 920 $new_content = ob_get_contents(); 903 921 904 922 ob_end_clean(); 905 906 923 907 924 /** Forums ************************************************************/ … … 963 980 ob_start(); 964 981 965 bbp_get_template_part( 'bbpress/form', ' split' );982 bbp_get_template_part( 'bbpress/form', 'topic-split' ); 966 983 967 984 $new_content = ob_get_contents(); … … 973 990 ob_start(); 974 991 975 bbp_get_template_part( 'bbpress/form', ' merge' );992 bbp_get_template_part( 'bbpress/form', 'topic-merge' ); 976 993 977 994 $new_content = ob_get_contents(); … … 996 1013 /** Views *************************************************************/ 997 1014 998 } elseif ( bbp_is_ view() ) {1015 } elseif ( bbp_is_single_view() ) { 999 1016 $new_content = $bbp->shortcodes->display_view( array( 'id' => get_query_var( 'bbp_view' ) ) ); 1000 1017 … … 1124 1141 } 1125 1142 1143 /** 1144 * Used to guess if page exists at requested path 1145 * 1146 * @since bbPress (r3304) 1147 * 1148 * @uses get_option() To see if pretty permalinks are enabled 1149 * @uses get_page_by_path() To see if page exists at path 1150 * 1151 * @param string $path 1152 * @return mixed False if no page, Page object if true 1153 */ 1154 function bbp_get_page_by_path( $path = '' ) { 1155 1156 // Default to false 1157 $retval = false; 1158 1159 // Path is not empty 1160 if ( !empty( $path ) ) { 1161 1162 // Pretty permalinks are on so path might exist 1163 if ( get_option( 'permalink_structure' ) ) { 1164 $retval = get_page_by_path( $path ); 1165 } 1166 } 1167 1168 return apply_filters( 'bbp_get_page_by_path', $retval, $path ); 1169 } 1170 1171 /** Filters *******************************************************************/ 1172 1173 /** 1174 * Removes all filters from a WordPress filter, and stashes them in the $bbp 1175 * global in the event they need to be restored later. 1176 * 1177 * @since bbPress (r3251) 1178 * 1179 * @global bbPress $bbp 1180 * @global WP_filter $wp_filter 1181 * @global array $merged_filters 1182 * 1183 * @param string $tag 1184 * @param int $priority 1185 * 1186 * @return bool 1187 */ 1188 function bbp_remove_all_filters( $tag, $priority = false ) { 1189 global $bbp, $wp_filter, $merged_filters; 1190 1191 // Filters exist 1192 if ( isset( $wp_filter[$tag] ) ) { 1193 1194 // Filters exist in this priority 1195 if ( !empty( $priority ) && isset( $wp_filter[$tag][$priority] ) ) { 1196 1197 // Store filters in a backup 1198 $bbp->filters->wp_filter[$tag][$priority] = $wp_filter[$tag][$priority]; 1199 1200 // Unset the filters 1201 unset( $wp_filter[$tag][$priority] ); 1202 1203 // Priority is empty 1204 } else { 1205 1206 // Store filters in a backup 1207 $bbp->filters->wp_filter[$tag] = $wp_filter[$tag]; 1208 1209 // Unset the filters 1210 unset( $wp_filter[$tag] ); 1211 } 1212 } 1213 1214 // Check merged filters 1215 if ( isset( $merged_filters[$tag] ) ) { 1216 1217 // Store filters in a backup 1218 $bbp->filters->merged_filters[$tag] = $merged_filters[$tag]; 1219 1220 // Unset the filters 1221 unset( $merged_filters[$tag] ); 1222 } 1223 1224 return true; 1225 } 1226 1227 /** 1228 * Restores filters from the $bbp global that were removed using 1229 * bbp_remove_all_filters() 1230 * 1231 * @since bbPress (r3251) 1232 * 1233 * @global bbPress $bbp 1234 * @global WP_filter $wp_filter 1235 * @global array $merged_filters 1236 * 1237 * @param string $tag 1238 * @param int $priority 1239 * 1240 * @return bool 1241 */ 1242 function bbp_restore_all_filters( $tag, $priority = false ) { 1243 global $bbp, $wp_filter, $merged_filters; 1244 1245 // Filters exist 1246 if ( isset( $bbp->filters->wp_filter[$tag] ) ) { 1247 1248 // Filters exist in this priority 1249 if ( !empty( $priority ) && isset( $bbp->filters->wp_filter[$tag][$priority] ) ) { 1250 1251 // Store filters in a backup 1252 $wp_filter[$tag][$priority] = $bbp->filters->wp_filter[$tag][$priority]; 1253 1254 // Unset the filters 1255 unset( $bbp->filters->wp_filter[$tag][$priority] ); 1256 1257 // Priority is empty 1258 } else { 1259 1260 // Store filters in a backup 1261 $wp_filter[$tag] = $bbp->filters->wp_filter[$tag]; 1262 1263 // Unset the filters 1264 unset( $bbp->filters->wp_filter[$tag] ); 1265 } 1266 } 1267 1268 // Check merged filters 1269 if ( isset( $bbp->filters->merged_filters[$tag] ) ) { 1270 1271 // Store filters in a backup 1272 $merged_filters[$tag] = $bbp->filters->merged_filters[$tag]; 1273 1274 // Unset the filters 1275 unset( $bbp->filters->merged_filters[$tag] ); 1276 } 1277 1278 return true; 1279 } 1280 1281 /** 1282 * Add checks for view page, user page, user edit, topic edit and reply edit 1283 * pages. 1284 * 1285 * If it's a user page, WP_Query::bbp_is_single_user is set to true. 1286 * If it's a user edit page, WP_Query::bbp_is_single_user_edit is set to true 1287 * and the the 'wp-admin/includes/user.php' file is included. 1288 * In addition, on user/user edit pages, WP_Query::home is set to false & query 1289 * vars 'bbp_user_id' with the displayed user id and 'author_name' with the 1290 * displayed user's nicename are added. 1291 * 1292 * If it's a topic edit, WP_Query::bbp_is_topic_edit is set to true and 1293 * similarly, if it's a reply edit, WP_Query::bbp_is_reply_edit is set to true. 1294 * 1295 * If it's a view page, WP_Query::bbp_is_view is set to true 1296 * 1297 * @since bbPress (r2688) 1298 * 1299 * @global bbPress $bbp 1300 * #global WP_Query $wp_query 1301 * 1302 * @uses get_query_var() To get {@link WP_Query} query var 1303 * @uses is_email() To check if the string is an email 1304 * @uses get_user_by() To try to get the user by email and nicename 1305 * @uses WP_User to get the user data 1306 * @uses WP_Query::set_404() To set a 404 status 1307 * @uses current_user_can() To check if the current user can edit the user 1308 * @uses apply_filters() Calls 'enable_edit_any_user_configuration' with true 1309 * @uses wp_die() To die 1310 * @uses bbp_is_query_name() Check if query name is 'bbp_widget' 1311 * @uses bbp_get_view_query_args() To get the view query args 1312 * @uses bbp_get_topic_post_type() To get the topic post type 1313 * @uses bbp_get_reply_post_type() To get the reply post type 1314 * @uses is_multisite() To check if it's a multisite 1315 * @uses remove_action() To remove the auto save post revision action 1316 */ 1317 function bbp_pre_get_posts( $posts_query ) { 1318 global $bbp, $wp_the_query; 1319 1320 // Bail if $posts_query is not the main loop 1321 if ( $posts_query != $wp_the_query ) 1322 return $posts_query; 1323 1324 // Bail if filters are suppressed on this query, or in admin 1325 if ( true == $posts_query->get( 'suppress_filters' ) ) 1326 return $posts_query; 1327 1328 // Bail if in admin 1329 if ( is_admin() ) 1330 return $posts_query; 1331 1332 // Get query variables 1333 $bbp_user = $posts_query->get( $bbp->user_id ); 1334 $bbp_view = $posts_query->get( $bbp->view_id ); 1335 $is_edit = $posts_query->get( $bbp->edit_id ); 1336 1337 // It is a user page - We'll also check if it is user edit 1338 if ( !empty( $bbp_user ) ) { 1339 1340 // Not a user_id so try email and slug 1341 if ( !is_numeric( $bbp_user ) ) { 1342 1343 // Email was passed 1344 if ( is_email( $bbp_user ) ) 1345 $bbp_user = get_user_by( 'email', $bbp_user ); 1346 // Try nicename 1347 else 1348 $bbp_user = get_user_by( 'slug', $bbp_user ); 1349 1350 // If we were successful, set to ID 1351 if ( is_object( $bbp_user ) ) 1352 $bbp_user = $bbp_user->ID; 1353 } 1354 1355 // Create new user 1356 $user = new WP_User( $bbp_user ); 1357 1358 // Stop if no user 1359 if ( !isset( $user ) || empty( $user ) || empty( $user->ID ) ) { 1360 $posts_query->set_404(); 1361 return; 1362 } 1363 1364 /** User Exists *******************************************************/ 1365 1366 // View or edit? 1367 if ( !empty( $is_edit ) ) { 1368 1369 // Only allow super admins on multisite to edit every user. 1370 if ( ( is_multisite() && !current_user_can( 'manage_network_users' ) && $user_id != $current_user->ID && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) ) 1371 wp_die( __( 'You do not have the permission to edit this user.', 'bbpress' ) ); 1372 1373 // We are editing a profile 1374 $posts_query->bbp_is_single_user_edit = true; 1375 1376 // Load the core WordPress contact methods 1377 if ( !function_exists( '_wp_get_user_contactmethods' ) ) 1378 include_once( ABSPATH . 'wp-includes/registration.php' ); 1379 1380 // Load the edit_user functions 1381 if ( !function_exists( 'edit_user' ) ) 1382 require_once( ABSPATH . 'wp-admin/includes/user.php' ); 1383 1384 // We are viewing a profile 1385 } else { 1386 $posts_query->bbp_is_single_user = true; 1387 } 1388 1389 // Make sure 404 is not set 1390 $posts_query->is_404 = false; 1391 1392 // Correct is_home variable 1393 $posts_query->is_home = false; 1394 1395 // Set bbp_user_id for future reference 1396 $posts_query->query_vars['bbp_user_id'] = $user->ID; 1397 1398 // Set author_name as current user's nicename to get correct posts 1399 if ( !bbp_is_query_name( 'bbp_widget' ) ) 1400 $posts_query->query_vars['author_name'] = $user->user_nicename; 1401 1402 // Set the displayed user global to this user 1403 $bbp->displayed_user = $user; 1404 1405 // View Page 1406 } elseif ( !empty( $bbp_view ) ) { 1407 1408 // Check if the view exists by checking if there are query args are set 1409 $view_args = bbp_get_view_query_args( $bbp_view ); 1410 1411 // Stop if view args is false - means the view isn't registered 1412 if ( false === $view_args ) { 1413 $posts_query->set_404(); 1414 return; 1415 } 1416 1417 // Correct is_home variable 1418 $posts_query->is_home = false; 1419 1420 // We are in a custom topic view 1421 $posts_query->bbp_is_view = true; 1422 1423 // Topic/Reply Edit Page 1424 } elseif ( !empty( $is_edit ) ) { 1425 1426 // We are editing a topic 1427 if ( $posts_query->get( 'post_type' ) == bbp_get_topic_post_type() ) 1428 $posts_query->bbp_is_topic_edit = true; 1429 1430 // We are editing a reply 1431 elseif ( $posts_query->get( 'post_type' ) == bbp_get_reply_post_type() ) 1432 $posts_query->bbp_is_reply_edit = true; 1433 1434 // We save post revisions on our own 1435 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 1436 } 1437 1438 return $posts_query; 1439 } 1126 1440 1127 1441 ?> -
branches/plugin/bbp-includes/bbp-core-hooks.php
r3310 r3311 35 35 add_action( 'init', 'bbp_init', 10 ); 36 36 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 ); 37 add_filter( 'template_include', 'bbp_template_include', 10 ); 37 38 38 39 /** … … 69 70 70 71 // Theme Compat 71 add_action( 'bbp_setup_theme_compat', 'bbp_add_theme_compat' ); 72 add_action( 'bbp_setup_theme_compat', 'bbp_theme_compat_set_theme' ); 73 add_action( 'bbp_setup_theme_compat', 'bbp_theme_compat_enqueue_css' ); 72 74 73 75 // Admin … … 244 246 * bbp_template_include() works and do something similar. :) 245 247 */ 246 add_filter( 'template_include', 'bbp_template_include' ); 248 add_filter( 'bbp_template_include', 'bbp_template_include_theme_supports', 2, 1 ); 249 add_filter( 'bbp_template_include', 'bbp_template_include_theme_compat', 4, 2 ); 247 250 248 251 /** … … 587 590 } 588 591 592 /** Theme Compatibility Filter ************************************************/ 593 594 /** 595 * The main filter used for theme compatibility and displaying custom bbPress 596 * theme files. 597 * 598 * @since bbPress (r3311) 599 * 600 * @uses apply_filters() 601 * 602 * @param string $template 603 * @return string Template file to use 604 */ 605 function bbp_template_include( $template = '' ) { 606 return apply_filters( 'bbp_template_include', $template ); 607 } 608 589 609 ?> -
branches/plugin/bbp-includes/bbp-core-shortcodes.php
r3302 r3311 223 223 bbp_breadcrumb(); 224 224 225 // Before forums index 226 do_action( 'bbp_template_before_forums_index' ); 227 225 228 // Load the forums index 226 229 if ( bbp_has_forums() ) … … 230 233 else 231 234 bbp_get_template_part( 'bbpress/feedback', 'no-forums' ); 235 236 // After forums index 237 do_action( 'bbp_template_after_forums_index' ); 232 238 233 239 // Return contents of output buffer … … 266 272 $this->_ob_start(); 267 273 268 // Breadcrumb 269 bbp_breadcrumb(); 270 271 // Password protected 272 if ( post_password_required() ) { 273 274 // Output the password form 275 bbp_get_template_part( 'bbpress/form', 'protected' ); 276 277 // Not password protected, or password is already approved 278 } else { 279 280 // Check forum caps 281 if ( bbp_user_can_view_forum( array( 'forum_id' => $forum_id ) ) ) { 274 // Check forum caps 275 if ( bbp_user_can_view_forum( array( 'forum_id' => $forum_id ) ) ) { 276 277 // Breadcrumb 278 bbp_breadcrumb(); 279 280 // Before single forum 281 do_action( 'bbp_template_before_single_forum' ); 282 283 // Password protected 284 if ( post_password_required() ) { 285 286 // Output the password form 287 bbp_get_template_part( 'bbpress/form', 'protected' ); 288 289 // Not password protected, or password is already approved 290 } else { 282 291 283 292 // Forum description … … 331 340 } 332 341 333 // Forum is private and user does not have caps 334 } elseif ( bbp_is_forum_private( $forum_id, false ) ) { 335 bbp_get_template_part( 'bbpress/feedback', 'no-access' ); 342 // After single forum 343 do_action( 'bbp_template_after_single_forum' ); 336 344 } 345 346 // Forum is private and user does not have caps 347 } elseif ( bbp_is_forum_private( $forum_id, false ) ) { 348 bbp_get_template_part( 'bbpress/feedback', 'no-access' ); 337 349 } 338 350 … … 375 387 bbp_breadcrumb(); 376 388 389 // Before topics index 390 do_action( 'bbp_template_before_topics_index' ); 391 377 392 // Load the topic index 378 393 if ( bbp_has_topics( $topics_query ) ) { … … 385 400 bbp_get_template_part( 'bbpress/feedback', 'no-topics' ); 386 401 } 402 403 // After topics index 404 do_action( 'bbp_template_after_topics_index' ); 387 405 388 406 // Return contents of output buffer … … 430 448 431 449 // Reset the queries if not in theme compat 432 if ( !bbp_i n_theme_compat() ) {450 if ( !bbp_is_theme_compat_active() ) { 433 451 434 452 // Reset necessary forum_query attributes for topics loop to function … … 446 464 $this->_ob_start(); 447 465 448 // Breadcrumb 449 bbp_breadcrumb(); 450 451 // Password protected 452 if ( post_password_required() ) { 453 454 // Output the password form 455 bbp_get_template_part( 'bbpress/form', 'protected' ); 456 457 // Not password protected, or password is already approved 458 } else { 459 460 // Check forum caps 461 if ( bbp_user_can_view_forum( array( 'forum_id' => $forum_id ) ) ) { 466 // Check forum caps 467 if ( bbp_user_can_view_forum( array( 'forum_id' => $forum_id ) ) ) { 468 469 // Breadcrumb 470 bbp_breadcrumb(); 471 472 // Before single topic 473 do_action( 'bbp_template_before_single_topic' ); 474 475 // Password protected 476 if ( post_password_required() ) { 477 478 // Output the password form 479 bbp_get_template_part( 'bbpress/form', 'protected' ); 480 481 // Not password protected, or password is already approved 482 } else { 462 483 463 484 // Tags … … 467 488 bbp_single_topic_description( array( 'topic_id' => $topic_id ) ); 468 489 490 // Template files 491 if ( bbp_show_lead_topic() ) 492 bbp_get_template_part( 'bbpress/content', 'single-topic-lead' ); 493 469 494 // Load the topic 470 495 if ( bbp_has_replies( $replies_query ) ) { 471 496 472 // Template files473 bbp_get_template_part( 'bbpress/single', 'topic' );474 497 bbp_get_template_part( 'bbpress/pagination', 'replies' ); 475 498 bbp_get_template_part( 'bbpress/loop', 'replies' ); 476 499 bbp_get_template_part( 'bbpress/pagination', 'replies' ); 477 bbp_get_template_part( 'bbpress/form', 'reply' );478 500 479 501 // No replies 480 502 } else { 481 bbp_get_template_part( 'bbpress/single', 'topic' ); 482 bbp_get_template_part( 'bbpress/form', 'reply' ); 503 bbp_get_template_part( 'bbpress/content', 'single-topic-lead' ); 483 504 } 484 505 485 // Forum is private and user does not have caps 486 } elseif ( bbp_is_forum_private( $forum_id, false ) ) { 487 bbp_get_template_part( 'bbpress/feedback', 'no-access' ); 506 // Reply form 507 bbp_get_template_part( 'bbpress/form', 'reply' ); 488 508 } 509 510 // After single topic 511 do_action( 'bbp_template_after_single_topic' ); 512 513 // Forum is private and user does not have caps 514 } elseif ( bbp_is_forum_private( $forum_id, false ) ) { 515 bbp_get_template_part( 'bbpress/feedback', 'no-access' ); 489 516 } 490 517 … … 507 534 $this->_ob_start(); 508 535 509 // Breadcrumb510 if ( bbp_is_forum() || bbp_is_topic_edit() )511 bbp_breadcrumb();512 513 // Editing a topic514 if ( bbp_is_topic_edit() ) {515 516 // Tags517 bbp_topic_tag_list( get_the_ID() );518 519 // Topic description520 bbp_single_topic_description( array( 'topic_id' => get_the_ID() ) );521 522 }523 524 536 // Output templates 525 bbp_get_template_part( 'bbpress/form', 'topic' );537 bbp_get_template_part( 'bbpress/form', 'topic' ); 526 538 527 539 // Return contents of output buffer … … 545 557 $this->_ob_start(); 546 558 547 // Breadcrumb548 if ( bbp_is_reply_edit() )549 bbp_breadcrumb();550 551 559 // Output templates 552 bbp_get_template_part( 'bbpress/form', 'reply' );560 bbp_get_template_part( 'bbpress/form', 'reply' ); 553 561 554 562 // Return contents of output buffer … … 632 640 bbp_topic_tag_description(); 633 641 642 // Before tag topics 643 do_action( 'bbp_template_before_tag_topics' ); 644 634 645 // Load the topics 635 646 if ( bbp_has_topics( $args ) ) { … … 645 656 bbp_get_template_part( 'bbpress/feedback', 'no-topics' ); 646 657 } 658 659 // After tag topics 660 do_action( 'bbp_template_after_tag_topics' ); 647 661 648 662 // Return contents of output buffer -
branches/plugin/bbp-includes/bbp-topic-template.php
r3309 r3311 234 234 235 235 // Profile page 236 if ( bbp_is_ user_profile_page() )236 if ( bbp_is_single_user() ) 237 237 $base = user_trailingslashit( trailingslashit( bbp_get_user_profile_url( bbp_get_displayed_user_id() ) ) . 'page/%#%/' ); 238 238 239 239 // View 240 elseif ( bbp_is_ view() )240 elseif ( bbp_is_single_view() ) 241 241 $base = user_trailingslashit( trailingslashit( bbp_get_view_url() ) . 'page/%#%/' ); 242 242 -
branches/plugin/bbp-includes/bbp-user-template.php
r3291 r3311 696 696 * @since bbPress (r2688) 697 697 * 698 * @uses bbp_is_ user_profile_page() To check if it's the profile page699 * @uses bbp_is_ user_profile_edit() To check if it's the profile edit page698 * @uses bbp_is_single_user() To check if it's the profile page 699 * @uses bbp_is_single_user_edit() To check if it's the profile edit page 700 700 */ 701 701 function bbp_notice_edit_user_success() { 702 if ( isset( $_GET['updated'] ) && ( bbp_is_ user_profile_page() || bbp_is_user_profile_edit() ) ) : ?>702 if ( isset( $_GET['updated'] ) && ( bbp_is_single_user() || bbp_is_single_user_edit() ) ) : ?> 703 703 704 704 <div class="bbp-template-notice updated"> … … 715 715 * 716 716 * @uses is_multisite() To check if the blog is multisite 717 * @uses bbp_is_ user_profile_page() To check if it's the profile page718 * @uses bbp_is_ user_profile_edit() To check if it's the profile edit page717 * @uses bbp_is_single_user() To check if it's the profile page 718 * @uses bbp_is_single_user_edit() To check if it's the profile edit page 719 719 * @uses current_user_can() To check if the current user can manage network 720 720 * options … … 724 724 */ 725 725 function bbp_notice_edit_user_is_super_admin() { 726 if ( is_multisite() && ( bbp_is_ user_profile_page() || bbp_is_user_profile_edit() ) && current_user_can( 'manage_network_options' ) && is_super_admin( bbp_get_displayed_user_id() ) ) : ?>726 if ( is_multisite() && ( bbp_is_single_user() || bbp_is_single_user_edit() ) && current_user_can( 'manage_network_options' ) && is_super_admin( bbp_get_displayed_user_id() ) ) : ?> 727 727 728 728 <div class="bbp-template-notice important"> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-reply.php
r3210 r3311 13 13 ?> 14 14 15 <?php if ( bbp_is_reply_edit() || bbp_is_topic_open() || current_user_can( 'edit_topic', bbp_get_topic_id()) ) : ?>15 <?php if ( bbp_is_reply_edit() ) : ?> 16 16 17 <?php if ( ( bbp_is_reply_edit() && current_user_can( 'edit_reply', bbp_get_reply_id() ) ) || ( current_user_can( 'publish_topics' ) || bbp_allow_anonymous() ) ) :?>17 <?php bbp_breadcrumb(); ?> 18 18 19 <div id="new-reply-<?php bbp_topic_id(); ?>" class="bbp-reply-form">19 <?php endif; ?> 20 20 21 <form id="new-post" name="new-post" method="post" action=""> 22 <fieldset class="bbp-form"> 23 <legend><?php printf( __( 'Reply to: “%s”', 'bbpress' ), bbp_get_topic_title() ); ?></legend> 21 <?php if ( bbp_is_reply_edit() || bbp_is_topic_open() || current_user_can( 'edit_topic', bbp_get_topic_id() ) ) : ?> 24 22 25 <?php if ( !bbp_is_topic_open() && !bbp_is_reply_edit() ) : ?>23 <?php if ( ( bbp_is_reply_edit() && current_user_can( 'edit_reply', bbp_get_reply_id() ) ) || ( current_user_can( 'publish_topics' ) || bbp_allow_anonymous() ) ) : ?> 26 24 27 <div class="bbp-template-notice"> 28 <p><?php _e( 'This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p> 29 </div> 25 <div id="new-reply-<?php bbp_topic_id(); ?>" class="bbp-reply-form"> 30 26 31 <?php endif; ?> 27 <form id="new-post" name="new-post" method="post" action=""> 28 <fieldset class="bbp-form"> 29 <legend><?php printf( __( 'Reply to: “%s”', 'bbpress' ), bbp_get_topic_title() ); ?></legend> 32 30 33 <?php if ( current_user_can( 'unfiltered_html') ) : ?>31 <?php if ( !bbp_is_topic_open() && !bbp_is_reply_edit() ) : ?> 34 32 35 <div class="bbp-template-notice"> 36 <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p> 37 </div> 38 39 <?php endif; ?> 40 41 <?php do_action( 'bbp_template_notices' ); ?> 42 43 <div> 44 45 <div class="avatar"> 46 47 <?php bbp_is_reply_edit() ? bbp_reply_author_avatar( bbp_get_reply_id(), 120 ) : bbp_current_user_avatar( 120 ); ?> 48 49 </div> 50 51 <?php bbp_get_template_part( 'bbpress/form', 'anonymous' ); ?> 52 53 <p> 54 <label for="bbp_reply_content"><?php _e( 'Reply:', 'bbpress' ); ?></label><br /> 55 <textarea id="bbp_reply_content" tabindex="<?php bbp_tab_index(); ?>" name="bbp_reply_content" cols="51" rows="6"><?php bbp_form_reply_content(); ?></textarea> 56 </p> 57 58 <?php if ( !current_user_can( 'unfiltered_html' ) ) : ?> 59 60 <p class="form-allowed-tags"> 61 <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br /> 62 <code><?php bbp_allowed_tags(); ?></code> 63 </p> 33 <div class="bbp-template-notice"> 34 <p><?php _e( 'This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p> 35 </div> 64 36 65 37 <?php endif; ?> 66 38 67 <p> 68 <label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br /> 69 <input id="bbp_topic_tags" type="text" value="<?php bbp_form_topic_tags(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_tags" /> 70 </p> 39 <?php if ( current_user_can( 'unfiltered_html' ) ) : ?> 71 40 72 <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_reply_edit() || ( bbp_is_reply_edit() && !bbp_is_reply_anonymous() ) ) ) : ?> 73 74 <p> 75 76 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" /> 77 78 <?php if ( bbp_is_reply_edit() && $post->post_author != bbp_get_current_user_id() ) : ?> 79 80 <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label> 81 82 <?php else : ?> 83 84 <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label> 85 86 <?php endif; ?> 87 88 </p> 41 <div class="bbp-template-notice"> 42 <p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p> 43 </div> 89 44 90 45 <?php endif; ?> 91 46 92 <?php if ( bbp_is_reply_edit() ) :?>47 <?php do_action( 'bbp_template_notices' ); ?> 93 48 94 <fieldset class="bbp-form"> 95 <legend><?php _e( 'Revision', 'bbpress' ); ?></legend> 96 <div> 97 <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" /> 98 <label for="bbp_log_reply_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br /> 99 </div> 49 <div> 100 50 101 <div> 102 <label for="bbp_reply_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br /> 103 <input type="text" value="<?php bbp_form_reply_edit_reason(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_reply_edit_reason" id="bbp_reply_edit_reason" /> 104 </div> 105 </fieldset> 51 <div class="avatar"> 106 52 107 <?php else :?>53 <?php bbp_is_reply_edit() ? bbp_reply_author_avatar( bbp_get_reply_id(), 120 ) : bbp_current_user_avatar( 120 ); ?> 108 54 109 < ?php bbp_topic_admin_links(); ?>55 </div> 110 56 111 <?php endif; ?>57 <?php bbp_get_template_part( 'bbpress/form', 'anonymous' ); ?> 112 58 113 <div class="bbp-submit-wrapper"> 114 <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_reply_submit" name="bbp_reply_submit"><?php _e( 'Submit', 'bbpress' ); ?></button> 59 <p> 60 <label for="bbp_reply_content"><?php _e( 'Reply:', 'bbpress' ); ?></label><br /> 61 <textarea id="bbp_reply_content" tabindex="<?php bbp_tab_index(); ?>" name="bbp_reply_content" cols="51" rows="6"><?php bbp_form_reply_content(); ?></textarea> 62 </p> 63 64 <?php if ( !current_user_can( 'unfiltered_html' ) ) : ?> 65 66 <p class="form-allowed-tags"> 67 <label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br /> 68 <code><?php bbp_allowed_tags(); ?></code> 69 </p> 70 71 <?php endif; ?> 72 73 <p> 74 <label for="bbp_topic_tags"><?php _e( 'Tags:', 'bbpress' ); ?></label><br /> 75 <input id="bbp_topic_tags" type="text" value="<?php bbp_form_topic_tags(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_tags" /> 76 </p> 77 78 <?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_reply_edit() || ( bbp_is_reply_edit() && !bbp_is_reply_anonymous() ) ) ) : ?> 79 80 <p> 81 82 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" /> 83 84 <?php if ( bbp_is_reply_edit() && $post->post_author != bbp_get_current_user_id() ) : ?> 85 86 <label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label> 87 88 <?php else : ?> 89 90 <label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label> 91 92 <?php endif; ?> 93 94 </p> 95 96 <?php endif; ?> 97 98 <?php if ( bbp_is_reply_edit() ) : ?> 99 100 <fieldset class="bbp-form"> 101 <legend><?php _e( 'Revision', 'bbpress' ); ?></legend> 102 <div> 103 <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" /> 104 <label for="bbp_log_reply_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br /> 105 </div> 106 107 <div> 108 <label for="bbp_reply_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br /> 109 <input type="text" value="<?php bbp_form_reply_edit_reason(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_reply_edit_reason" id="bbp_reply_edit_reason" /> 110 </div> 111 </fieldset> 112 113 <?php else : ?> 114 115 <?php bbp_topic_admin_links(); ?> 116 117 <?php endif; ?> 118 119 <div class="bbp-submit-wrapper"> 120 <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_reply_submit" name="bbp_reply_submit"><?php _e( 'Submit', 'bbpress' ); ?></button> 121 </div> 115 122 </div> 116 </div>117 123 118 <?php bbp_reply_form_fields(); ?>124 <?php bbp_reply_form_fields(); ?> 119 125 120 </fieldset> 121 </form> 122 </div> 126 </fieldset> 127 </form> 128 </div> 129 130 <?php else : ?> 131 132 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply"> 133 <div class="bbp-template-notice"> 134 <p><?php is_user_logged_in() ? _e( 'You cannot reply to this topic.', 'bbpress' ) : _e( 'You must be logged in to reply to this topic.', 'bbpress' ); ?></p> 135 </div> 136 </div> 137 138 <?php endif; ?> 123 139 124 140 <?php else : ?> … … 126 142 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply"> 127 143 <div class="bbp-template-notice"> 128 <p><?php is_user_logged_in() ? _e( 'You cannot reply to this topic.', 'bbpress' ) : _e( 'You must be logged in to reply to this topic.', 'bbpress' ); ?></p>144 <p><?php _e( 'This topic has been closed to new replies.', 'bbpress' ); ?></p> 129 145 </div> 130 146 </div> 131 147 132 148 <?php endif; ?> 133 134 <?php else : ?>135 136 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">137 <div class="bbp-template-notice">138 <p><?php _e( 'This topic has been closed to new replies.', 'bbpress' ); ?></p>139 </div>140 </div>141 142 <?php endif; ?> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/form-topic.php
r3246 r3311 12 12 13 13 ?> 14 15 <?php if ( !bbp_is_forum() ) : ?> 16 17 <?php bbp_breadcrumb(); ?> 18 19 <?php endif; ?> 20 21 <?php if ( bbp_is_topic_edit() ) : ?> 22 23 <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?> 24 25 <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?> 26 27 <?php endif; ?> 14 28 15 29 <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/loop-forums.php
r3250 r3311 9 9 10 10 ?> 11 12 <?php do_action( 'bbp_template_before_forums_loop' ); ?> 11 13 12 14 <table class="bbp-forums"> … … 61 63 62 64 </table> 65 66 <?php do_action( 'bbp_template_after_forums_loop' ); ?> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/loop-replies.php
r3242 r3311 9 9 10 10 ?> 11 12 <?php do_action( 'bbp_template_before_replies_loop' ); ?> 11 13 12 14 <table class="bbp-replies" id="topic-<?php bbp_topic_id(); ?>-replies"> … … 96 98 97 99 </table> 100 101 <?php do_action( 'bbp_template_after_replies_loop' ); ?> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/loop-topics.php
r3142 r3311 9 9 10 10 ?> 11 12 <?php do_action( 'bbp_template_before_topics_loop' ); ?> 11 13 12 14 <table class="bbp-topics" id="bbp-forum-<?php bbp_topic_id(); ?>"> … … 93 95 94 96 </table><!-- #bbp-forum-<?php bbp_topic_id(); ?> --> 97 98 <?php do_action( 'bbp_template_after_topics_loop' ); ?> 99 -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/pagination-replies.php
r2943 r3311 9 9 10 10 ?> 11 12 <?php do_action( 'bbp_template_before_pagination_loop' ); ?> 11 13 12 14 <div class="bbp-pagination"> … … 23 25 </div> 24 26 </div> 27 28 <?php do_action( 'bbp_template_after_pagination_loop' ); ?> -
branches/plugin/bbp-themes/bbp-twentyten/bbpress/pagination-topics.php
r2943 r3311 9 9 10 10 ?> 11 12 <?php do_action( 'bbp_template_before_pagination_loop' ); ?> 11 13 12 14 <div class="bbp-pagination"> … … 23 25 </div> 24 26 </div> 27 28 <?php do_action( 'bbp_template_after_pagination_loop' ); ?> -
branches/plugin/bbp-themes/bbp-twentyten/functions.php
r3205 r3311 153 153 * @uses bbp_is_topic() To check if it's the topic page 154 154 * @uses get_stylesheet_directory_uri() To get the stylesheet directory uri 155 * @uses bbp_is_ user_profile_edit() To check if it's the profile edit page155 * @uses bbp_is_single_user_edit() To check if it's the profile edit page 156 156 * @uses wp_enqueue_script() To enqueue the scripts 157 157 */ … … 160 160 wp_enqueue_script( 'bbp_topic', get_stylesheet_directory_uri() . '/js/topic.js', array( 'wp-lists' ), '20101202' ); 161 161 162 if ( bbp_is_ user_profile_edit() )162 if ( bbp_is_single_user_edit() ) 163 163 wp_enqueue_script( 'user-profile' ); 164 164 } … … 174 174 * @uses bbp_is_topic() To check if it's the topic page 175 175 * @uses admin_url() To get the admin url 176 * @uses bbp_is_ user_profile_edit() To check if it's the profile edit page176 * @uses bbp_is_single_user_edit() To check if it's the profile edit page 177 177 */ 178 178 function bbp_twentyten_scripts () { … … 185 185 </script> 186 186 187 <?php elseif ( bbp_is_ user_profile_edit() ) : ?>187 <?php elseif ( bbp_is_single_user_edit() ) : ?> 188 188 189 189 <script type="text/javascript" charset="utf-8"> -
branches/plugin/bbp-themes/bbp-twentyten/single-forum.php
r3302 r3311 25 25 <div class="entry-content"> 26 26 27 <?php bbp_breadcrumb(); ?> 28 29 <?php if ( post_password_required() ) : ?> 30 31 <?php bbp_get_template_part( 'bbpress/form', 'protected' ); ?> 32 33 <?php else : ?> 34 35 <?php bbp_single_forum_description(); ?> 36 37 <?php if ( bbp_get_forum_subforum_count() && bbp_has_forums() ) : ?> 38 39 <?php bbp_get_template_part( 'bbpress/loop', 'forums' ); ?> 40 41 <?php endif; ?> 42 43 <?php if ( !bbp_is_forum_category() && bbp_has_topics() ) : ?> 44 45 <?php bbp_get_template_part( 'bbpress/pagination', 'topics' ); ?> 46 47 <?php bbp_get_template_part( 'bbpress/loop', 'topics' ); ?> 48 49 <?php bbp_get_template_part( 'bbpress/pagination', 'topics' ); ?> 50 51 <?php bbp_get_template_part( 'bbpress/form', 'topic' ); ?> 52 53 <?php elseif( !bbp_is_forum_category() ) : ?> 54 55 <?php bbp_get_template_part( 'bbpress/feedback', 'no-topics' ); ?> 56 57 <?php bbp_get_template_part( 'bbpress/form', 'topic' ); ?> 58 59 <?php endif; ?> 60 61 <?php endif; ?> 27 <?php bbp_get_template_part( 'bbpress/content', 'single-forum' ); ?> 62 28 63 29 </div> -
branches/plugin/bbp-themes/bbp-twentyten/single-topic.php
r3302 r3311 25 25 <div class="entry-content"> 26 26 27 <?php bbp_breadcrumb(); ?> 28 29 <?php if ( post_password_required() ) : ?> 30 31 <?php bbp_get_template_part( 'bbpress/form', 'protected' ); ?> 32 33 <?php else : ?> 34 35 <?php bbp_topic_tag_list(); ?> 36 37 <?php bbp_single_topic_description(); ?> 38 39 <div id="ajax-response"></div> 40 41 <?php bbp_get_template_part( 'bbpress/single', 'topic' ); ?> 42 43 <?php if ( bbp_get_query_name() || bbp_has_replies() ) : ?> 44 45 <?php bbp_get_template_part( 'bbpress/pagination', 'replies' ); ?> 46 47 <?php bbp_get_template_part( 'bbpress/loop', 'replies' ); ?> 48 49 <?php bbp_get_template_part( 'bbpress/pagination', 'replies' ); ?> 50 51 <?php endif; ?> 52 53 <?php bbp_get_template_part( 'bbpress/form', 'reply' ); ?> 54 55 <?php endif; ?> 27 <?php bbp_get_template_part( 'bbpress/content', 'single-topic' ); ?> 56 28 57 29 </div>
Note: See TracChangeset
for help on using the changeset viewer.