Ticket #2036: 2036.3.diff
File 2036.3.diff, 46.8 KB (added by , 10 years ago) |
---|
-
includes/admin/metaboxes.php
402 402 // Get some meta 403 403 $reply_topic_id = bbp_get_reply_topic_id( $post_id ); 404 404 $reply_forum_id = bbp_get_reply_forum_id( $post_id ); 405 $reply_to = bbp_get_reply_to( $post_id ); 405 406 406 407 // Allow individual manipulation of reply forum 407 408 if ( current_user_can( 'edit_others_replies' ) || current_user_can( 'moderate' ) ) : ?> … … 438 439 <input name="parent_id" id="bbp_topic_id" type="text" value="<?php echo esc_attr( $reply_topic_id ); ?>" /> 439 440 </p> 440 441 442 <p> 443 <strong class="label"><?php _e( 'Reply To:', 'bbpress' ); ?></strong> 444 <label class="screen-reader-text" for="bbp_reply_to"><?php _e( 'Reply To', 'bbpress' ); ?></label> 445 <input name="bbp_reply_to" id="bbp_reply_to" type="text" value="<?php echo esc_attr( $reply_to ); ?>" /> 446 </p> 447 441 448 <?php 442 449 wp_nonce_field( 'bbp_reply_metabox_save', 'bbp_reply_metabox' ); 443 450 do_action( 'bbp_reply_metabox', $post_id ); -
includes/admin/replies.php
224 224 '<ul>' . 225 225 '<li>' . __( '<strong>Forum</strong> dropdown determines the parent forum that the reply belongs to. Select the forum, or leave the default (Use Forum of Topic) to post the reply in forum of the topic.', 'bbpress' ) . '</li>' . 226 226 '<li>' . __( '<strong>Topic</strong> determines the parent topic that the reply belongs to.', 'bbpress' ) . '</li>' . 227 '<li>' . __( '<strong>Reply To</strong> determines the threading of the reply.', 'bbpress' ) . '</li>' . 227 228 '</ul>' 228 229 ) ); 229 230 … … 312 313 // Get the reply meta post values 313 314 $topic_id = !empty( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0; 314 315 $forum_id = !empty( $_POST['bbp_forum_id'] ) ? (int) $_POST['bbp_forum_id'] : bbp_get_topic_forum_id( $topic_id ); 316 $reply_to = !empty( $_POST['bbp_reply_to'] ) ? (int) $_POST['bbp_reply_to'] : 0; 315 317 316 318 // Formally update the reply 317 bbp_update_reply( $reply_id, $topic_id, $forum_id );319 bbp_update_reply( $reply_id, $topic_id, $forum_id, false, 0, false, $reply_to ); 318 320 319 321 // Allow other fun things to happen 320 do_action( 'bbp_reply_attributes_metabox_save', $reply_id, $topic_id, $forum_id );322 do_action( 'bbp_reply_attributes_metabox_save', $reply_id, $topic_id, $forum_id, $reply_to ); 321 323 322 324 return $reply_id; 323 325 } -
includes/admin/settings.php
169 169 170 170 'bbp_settings_theme_compat' => array( 171 171 172 // Replies per page setting172 // Theme package setting 173 173 '_bbp_theme_package_id' => array( 174 174 'title' => __( 'Current Package', 'bbpress' ), 175 175 'callback' => 'bbp_admin_setting_callback_subtheme_id', … … 196 196 'callback' => 'bbp_admin_setting_callback_replies_per_page', 197 197 'sanitize_callback' => 'intval', 198 198 'args' => array() 199 ), 200 201 // Set reply threading level 202 '_bbp_thread_replies_depth' => array( 203 'title' => __( 'Thread level', 'bbpress' ), 204 'callback' => 'bbp_admin_setting_callback_thread_replies_depth', 205 'sanitize_callback' => 'intval', 206 'args' => array() 199 207 ) 200 208 ), 201 209 … … 461 469 } 462 470 463 471 /** 472 * Hierarchical reply max depth level setting field; replies will be threaded 473 * if depth is 2 or greater 474 * 475 * @since bbPress (r####) 476 * 477 * @uses apply_filters() Calls 'bbp_thread_replies_depth_max' to set a 478 * maximum displayed level 479 * @uses selected() To display the selected attribute 480 */ 481 function bbp_admin_setting_callback_thread_replies_depth() { 482 483 // Set maximum depth for dropdown 484 $max_depth = (int) apply_filters( 'bbp_thread_replies_depth_max', 10 ); 485 $current_depth = get_option( '_bbp_thread_replies_depth' ); 486 487 ?> 488 <label for="_bbp_thread_replies_depth"> 489 <select id="_bbp_thread_replies_depth" name="_bbp_thread_replies_depth"> 490 <?php for ( $i = 0; $i <= $max_depth; $i++ ) : ?> 491 492 <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, $current_depth ); ?>><?php echo esc_html( $i ); ?></option> 493 494 <?php endfor; ?> 495 </select> 496 <?php _e( ' levels deep', 'bbpress' ); ?> 497 </label> 498 <?php 499 } 500 501 /** 464 502 * Allow topic and reply revisions 465 503 * 466 504 * @since bbPress (r3412) -
includes/common/classes.php
259 259 } 260 260 } 261 261 262 /** 263 * Create hierarchical list of bbPress replies. 264 * 265 * @package bbPress 266 * @subpackage Classes 267 * 268 * @since bbPress (r####) 269 */ 270 class Walker_Reply extends Walker { 271 272 /** 273 * @see Walker::$tree_type 274 * 275 * @since bbPress (r####) 276 * 277 * @var string 278 */ 279 var $tree_type = 'reply'; 280 281 /** 282 * @see Walker::$db_fields 283 * 284 * @since bbPress (r####) 285 * 286 * @var array 287 */ 288 var $db_fields = array( 289 'parent' => 'reply_to', 290 'id' => 'ID' 291 ); 292 293 /** 294 * @see Walker::start_lvl() 295 * 296 * @since bbPress (r####) 297 * 298 * @param string $output Passed by reference. Used to append additional content 299 * @param int $depth Depth of reply 300 * @param array $args Uses 'style' argument for type of HTML list 301 */ 302 public function start_lvl( &$output, $depth = 0, $args = array() ) { 303 $GLOBALS['reply_depth'] = $depth + 1; 304 305 switch ( $args['style'] ) { 306 case 'div': 307 break; 308 case 'ol': 309 echo "<ol class='children'>\n"; 310 break; 311 case 'ul': 312 default: 313 echo "<ul class='children'>\n"; 314 break; 315 } 316 } 317 318 /** 319 * @see Walker::end_lvl() 320 * 321 * @since bbPress (r####) 322 * 323 * @param string $output Passed by reference. Used to append additional content 324 * @param int $depth Depth of reply 325 * @param array $args Will only append content if style argument value is 'ol' or 'ul' 326 */ 327 public function end_lvl( &$output, $depth = 0, $args = array() ) { 328 $GLOBALS['reply_depth'] = $depth + 1; 329 330 switch ( $args['style'] ) { 331 case 'div': 332 break; 333 case 'ol': 334 echo "</ol>\n"; 335 break; 336 case 'ul': 337 default: 338 echo "</ul>\n"; 339 break; 340 } 341 } 342 343 /** 344 * @since bbPress (r####) 345 */ 346 public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { 347 348 if ( !$element ) 349 return; 350 351 // Get element's id 352 $id_field = $this->db_fields['id']; 353 $id = $element->$id_field; 354 355 // Display element 356 parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); 357 358 // If we're at the max depth and the current element still has children, loop over those 359 // and display them at this level to prevent them being orphaned to the end of the list. 360 if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) { 361 foreach ( $children_elements[ $id ] as $child ) 362 $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output ); 363 364 unset( $children_elements[ $id ] ); 365 } 366 } 367 368 /** 369 * @see Walker:start_el() 370 * 371 * @since bbPress (r####) 372 */ 373 public function start_el( &$output, $reply, $depth, $args, $id = 0 ) { 374 375 // Set up reply 376 $depth++; 377 $GLOBALS['reply_depth'] = $depth; 378 bbpress()->reply_query->post = $reply; 379 bbpress()->current_reply_id = $reply->ID; 380 381 // Check for a callback and use it if specified 382 if ( !empty($args['callback']) ) { 383 call_user_func( $args['callback'], $reply, $args, $depth ); 384 return; 385 } 386 387 // Style for div or list element 388 if ( 'div' == $args['style'] ) { 389 $tag = 'div'; 390 $add_below = 'reply'; 391 } else { 392 $tag = 'li'; 393 $add_below = 'div-reply'; 394 } ?> 395 396 <<?php echo $tag ?>> 397 398 <div id="reply-<?php bbp_reply_ID(); ?>"> 399 400 <?php bbp_get_template_part( 'loop', 'single-reply' ); ?> 401 402 <?php if ( $reply->post_type == bbp_get_reply_post_type() ) : ?> 403 404 <div class="bbp-reply-to"><?php bbp_reply_to_link( array_merge( $args, array( 'depth' => $depth ) ), $reply ); ?></div> 405 406 <?php endif; ?> 407 408 </div> 409 410 <?php 411 } 412 413 /** 414 * @since bbPress (r####) 415 */ 416 public function end_el( &$output, $reply, $depth = 0, $args = array() ) { 417 418 // Check for a callback and use it if specified 419 if ( !empty($args['end-callback']) ) { 420 call_user_func( $args['end-callback'], $reply, $args, $depth ); 421 return; 422 } 423 424 // Style for div or list element 425 if ( 'div' == $args['style'] ) 426 echo "</div>\n"; 427 else 428 echo "</li>\n"; 429 430 } 431 } 432 262 433 endif; // class_exists check -
includes/common/template-tags.php
1534 1534 1535 1535 <input type="hidden" name="bbp_reply_title" id="bbp_reply_title" value="<?php bbp_reply_title(); ?>" /> 1536 1536 <input type="hidden" name="bbp_reply_id" id="bbp_reply_id" value="<?php bbp_reply_id(); ?>" /> 1537 <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="<?php bbp_form_reply_to(); ?>" /> 1537 1538 <input type="hidden" name="action" id="bbp_post_action" value="bbp-edit-reply" /> 1538 1539 1539 1540 <?php if ( current_user_can( 'unfiltered_html' ) ) … … 1545 1546 1546 1547 <input type="hidden" name="bbp_reply_title" id="bbp_reply_title" value="<?php printf( __( 'Reply To: %s', 'bbpress' ), bbp_get_topic_title() ); ?>" /> 1547 1548 <input type="hidden" name="bbp_topic_id" id="bbp_topic_id" value="<?php bbp_topic_id(); ?>" /> 1549 <input type="hidden" name="bbp_reply_to" id="bbp_reply_to" value="<?php bbp_form_reply_to(); ?>" /> 1548 1550 <input type="hidden" name="action" id="bbp_post_action" value="bbp-new-reply" /> 1549 1551 1550 1552 <?php if ( current_user_can( 'unfiltered_html' ) ) -
includes/core/actions.php
174 174 add_action( 'bbp_forum_attributes_metabox_save', 'bbp_save_forum_extras', 2 ); 175 175 176 176 // New/Edit Reply 177 add_action( 'bbp_new_reply', 'bbp_update_reply', 10, 6);178 add_action( 'bbp_edit_reply', 'bbp_update_reply', 10, 6);177 add_action( 'bbp_new_reply', 'bbp_update_reply', 10, 7 ); 178 add_action( 'bbp_edit_reply', 'bbp_update_reply', 10, 7 ); 179 179 180 180 // Before Delete/Trash/Untrash Reply 181 181 add_action( 'wp_trash_post', 'bbp_trash_reply' ); -
includes/core/options.php
34 34 '_bbp_enable_favorites' => 1, // Favorites 35 35 '_bbp_enable_subscriptions' => 1, // Subscriptions 36 36 '_bbp_allow_topic_tags' => 1, // Topic Tags 37 '_bbp_thread_replies_depth' => 0, // Thread replies depth 37 38 '_bbp_allow_anonymous' => 0, // Allow anonymous posting 38 39 '_bbp_allow_global_access' => 1, // Users from all sites can post 39 40 '_bbp_use_wp_editor' => 1, // Use the WordPress editor if available … … 224 225 } 225 226 226 227 /** 228 * Are replies threaded 229 * 230 * @since bbPress (r####) 231 * 232 * @param bool $default Optional. Default value true 233 * @uses apply_filters() Calls 'bbp_thread_replies' with the calculated value and 234 * the thread replies depth 235 * @uses get_option() To get thread replies option 236 * @return bool Are replies threaded? 237 */ 238 function bbp_thread_replies() { 239 $retval = false; 240 $depth = bbp_thread_replies_depth(); 241 if ( $depth > 1 ) 242 $retval = true; 243 return (bool) apply_filters( 'bbp_thread_replies', $retval, $depth ); 244 } 245 246 /** 247 * Maximum reply thread depth 248 * 249 * @since bbPress (r####) 250 * 251 * @param int $default Thread replies depth 252 * @uses apply_filters() Calls 'bbp_thread_replies_depth' with the option value and 253 * the default depth 254 * @uses get_option() To get the thread replies depth 255 * @return int Thread replies depth 256 */ 257 function bbp_thread_replies_depth( $default = 0 ) { 258 return (int) apply_filters( 'bbp_thread_replies_depth', (int) get_option( '_bbp_thread_replies_depth', $default ) ); 259 } 260 261 /** 227 262 * Are topic and reply revisions allowed 228 263 * 229 264 * @since bbPress (r3412) … … 280 315 * @return bool Use WP editor? 281 316 */ 282 317 function bbp_use_wp_editor( $default = 1 ) { 318 // Disable if replies are threaded 319 if ( bbp_thread_replies() ) 320 return false; 283 321 return (bool) apply_filters( 'bbp_use_wp_editor', (bool) get_option( '_bbp_use_wp_editor', $default ) ); 284 322 } 285 323 -
includes/replies/functions.php
97 97 * @uses wp_set_post_terms() To set the topic tags 98 98 * @uses wp_insert_post() To insert the reply 99 99 * @uses do_action() Calls 'bbp_new_reply' with the reply id, topic id, forum 100 * id, anonymous data and reply author 100 * id, anonymous data, reply author, edit (false), and 101 * the reply to id 101 102 * @uses bbp_get_reply_url() To get the paginated url to the reply 102 103 * @uses wp_safe_redirect() To redirect to the reply url 103 104 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error … … 116 117 } 117 118 118 119 // Define local variable(s) 119 $topic_id = $forum_id = $reply_author = $anonymous_data = 0;120 $topic_id = $forum_id = $reply_author = $anonymous_data = $reply_to = 0; 120 121 $reply_title = $reply_content = $terms = ''; 121 122 122 123 /** Reply Author **********************************************************/ … … 165 166 bbp_add_error( 'bbp_reply_forum_id', __( '<strong>ERROR</strong>: Forum ID is missing.', 'bbpress' ) ); 166 167 } 167 168 169 /** Reply To **************************************************************/ 170 171 // Handle Reply To of the reply; $_REQUEST for non-JS submissions 172 if ( isset( $_REQUEST['bbp_reply_to'] ) ) { 173 $reply_to = (int) $_REQUEST['bbp_reply_to']; 174 } 175 176 $reply_to = bbp_get_reply_id( $reply_to ); 177 168 178 /** Unfiltered HTML *******************************************************/ 169 179 170 180 // Remove wp_filter_kses filters from title and content for capable users and if the nonce is verified … … 326 336 327 337 /** Update counts, etc... *********************************************/ 328 338 329 do_action( 'bbp_new_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author );339 do_action( 'bbp_new_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author, false, $reply_to ); 330 340 331 341 /** Additional Actions (After Save) ***********************************/ 332 342 … … 383 393 * @uses wp_update_post() To update the reply 384 394 * @uses bbp_get_reply_topic_id() To get the reply topic id 385 395 * @uses bbp_get_topic_forum_id() To get the topic forum id 396 * @uses bbp_get_reply_to() To get the reply to id 386 397 * @uses do_action() Calls 'bbp_edit_reply' with the reply id, topic id, forum 387 * id, anonymous data, reply author and bool true (for edit) 398 * id, anonymous data, reply author, bool true (for edit), 399 * and the reply to id 388 400 * @uses bbp_get_reply_url() To get the paginated url to the reply 389 401 * @uses wp_safe_redirect() To redirect to the reply url 390 402 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error … … 462 474 463 475 $forum_id = bbp_get_topic_forum_id( $topic_id ); 464 476 477 /** Reply To **************************************************************/ 478 479 $reply_to = bbp_get_reply_to( $reply_id ); 480 465 481 // Forum exists 466 482 if ( !empty( $forum_id ) && ( $forum_id !== bbp_get_reply_forum_id( $reply_id ) ) ) { 467 483 … … 611 627 if ( !empty( $reply_id ) && !is_wp_error( $reply_id ) ) { 612 628 613 629 // Update counts, etc... 614 do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author , true /* Is edit */ );630 do_action( 'bbp_edit_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author , true /* Is edit */, $reply_to ); 615 631 616 632 /** Additional Actions (After Save) ***********************************/ 617 633 … … 653 669 * @param bool|array $anonymous_data Optional logged-out user data. 654 670 * @param int $author_id Author id 655 671 * @param bool $is_edit Optional. Is the post being edited? Defaults to false. 672 * @param int $reply_to Optional. Reply to id 656 673 * @uses bbp_get_reply_id() To get the reply id 657 674 * @uses bbp_get_topic_id() To get the topic id 658 675 * @uses bbp_get_forum_id() To get the forum id … … 669 686 * @uses bbp_add_user_subscription() To add the user's subscription 670 687 * @uses bbp_update_reply_forum_id() To update the reply forum id 671 688 * @uses bbp_update_reply_topic_id() To update the reply topic id 689 * @uses bbp_update_reply_to() To update the reply to id 672 690 * @uses bbp_update_reply_walker() To update the reply's ancestors' counts 673 691 */ 674 function bbp_update_reply( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $author_id = 0, $is_edit = false ) {692 function bbp_update_reply( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $author_id = 0, $is_edit = false, $reply_to = 0 ) { 675 693 676 694 // Validate the ID's passed from 'bbp_new_reply' action 677 $reply_id = bbp_get_reply_id( $reply_id ); 678 $topic_id = bbp_get_topic_id( $topic_id ); 679 $forum_id = bbp_get_forum_id( $forum_id ); 695 $reply_id = bbp_get_reply_id( $reply_id ); 696 $topic_id = bbp_get_topic_id( $topic_id ); 697 $forum_id = bbp_get_forum_id( $forum_id ); 698 $reply_to = bbp_get_reply_id( $reply_to ); 680 699 681 700 // Bail if there is no reply 682 701 if ( empty( $reply_id ) ) … … 740 759 // Reply meta relating to reply position in tree 741 760 bbp_update_reply_forum_id( $reply_id, $forum_id ); 742 761 bbp_update_reply_topic_id( $reply_id, $topic_id ); 762 bbp_update_reply_to( $reply_id, $reply_to ); 743 763 744 764 // Update associated topic values if this is a new reply 745 765 if ( empty( $is_edit ) ) { … … 977 997 return apply_filters( 'bbp_update_reply_topic_id', (int) $topic_id, $reply_id ); 978 998 } 979 999 1000 /* 1001 * Update the reply's meta data with its reply to id 1002 * 1003 * @since bbPress (r####) 1004 * 1005 * @param int $reply_id Reply id to update 1006 * @param int $reply_to Optional. Reply to id 1007 * @uses bbp_get_reply_id() To get the reply id 1008 * @uses update_post_meta() To update the reply to meta 1009 * @uses apply_filters() Calls 'bbp_update_reply_to' with the reply id and 1010 * and reply to id 1011 * @return bool Reply's parent reply id 1012 */ 1013 function bbp_update_reply_to( $reply_id = 0, $reply_to = 0 ) { 1014 1015 // Validation 1016 $reply_id = bbp_get_reply_id( $reply_id ); 1017 $reply_to = bbp_get_reply_id( $reply_to ); 1018 1019 // Return if no reply 1020 if ( empty( $reply_id ) ) 1021 return; 1022 1023 // Return if no reply to 1024 if ( empty( $reply_to ) ) 1025 return; 1026 1027 // Set the reply to 1028 update_post_meta( $reply_id, '_bbp_reply_to', $reply_to ); 1029 1030 return (int) apply_filters( 'bbp_update_reply_to', (int) $reply_to, $reply_id ); 1031 } 1032 980 1033 /** 981 1034 * Update the revision log of the reply 982 1035 * … … 1999 2052 2000 2053 return (int) $reply_position; 2001 2054 } 2055 2056 /** Hierarchical Replies ******************************************************/ 2057 2058 /** 2059 * List replies 2060 * 2061 * @since bbPress (r####) 2062 */ 2063 function bbp_list_replies( $args = array(), $replies = null ) { 2064 global $reply_alt, $reply_depth, $reply_thread_alt; 2065 2066 // In reply loop 2067 bbpress()->reply_query->in_the_loop = true; 2068 2069 // Initialize variables 2070 $reply_alt = $reply_thread_alt = 0; 2071 $reply_depth = 1; 2072 2073 $defaults = array( 2074 'walker' => null, 2075 'max_depth' => bbp_thread_replies_depth(), 2076 'style' => 'ul', 2077 'callback' => null, 2078 'end_callback' => null, 2079 'page' => bbp_get_paged(), 2080 'per_page' => bbp_get_replies_per_page() 2081 ); 2082 2083 $r = wp_parse_args( $args, $defaults ); 2084 2085 // Get replies to loop through in $_replies 2086 if ( null !== $replies ) { 2087 $replies = (array) $replies; 2088 if ( empty( $replies ) ) 2089 return; 2090 $_replies = $replies; 2091 } else { 2092 if ( empty( bbpress()->reply_query->posts ) ) 2093 return; 2094 $_replies = bbpress()->reply_query->posts; 2095 } 2096 2097 if ( empty( $walker ) ) 2098 $walker = new Walker_Reply; 2099 2100 $walker->paged_walk( $_replies, $r['max_depth'], $r['page'], $r['per_page'], $r ); 2101 bbpress()->max_num_pages = $walker->max_pages; 2102 2103 bbpress()->reply_query->in_the_loop = false; 2104 } 2105 2106 /** 2107 * Update the hierarchical position of the reply. 2108 * 2109 * The hierarchical reply position is stored as _bbp_reply_position in the postmeta 2110 * table. This is done to prevent repeated complex queries to sort out reply 2111 * position. 2112 * 2113 * @since bbPress (r####) 2114 * 2115 * @param int $reply_id The reply id 2116 * @param int $reply_hierarchical_position Optional. The reply position 2117 * @return int The reply's hierarchical position (technically, the position of the reply's 2118 * ancestor in the uppermost level of the hierarchy). 2119 */ 2120 function bbp_update_reply_hierarchical_position( $reply_id = 0, $reply_hierarchical_position = 0 ) { 2121 2122 // Bail if reply_id is empty 2123 $reply_id = bbp_get_reply_id( $reply_id ); 2124 if ( empty( $reply_id ) ) 2125 return false; 2126 2127 // If no position was passed, get it from the db and update the menu_order 2128 if ( empty( $reply_hierarchical_position ) ) { 2129 $reply_hierarchical_position = bbp_get_reply_hierarchical_position_raw( $reply_id, bbp_get_reply_topic_id( $reply_id ) ); 2130 } 2131 2132 // Update the reply's meta _bbp_reply_position with the reply position 2133 update_post_meta( $reply_id, '_bbp_reply_position', $reply_hierarchical_position ); 2134 2135 return (int) $reply_hierarchical_position; 2136 } 2137 2138 /** 2139 * Get the hierarchical position of a reply by querying the DB directly for the 2140 * replies of a given topic. This function uses the time of the ancestor reply, as 2141 * that is the defining branch of the hierarchy of replies. 2142 * 2143 * @since bbPress (r####) 2144 * 2145 * @param int $reply_id The reply id 2146 * @param int $topic_id 2147 */ 2148 function bbp_get_reply_hierarchical_position_raw( $reply_id = 0, $topic_id = 0 ) { 2149 2150 // Get required data 2151 $reply_id = bbp_get_reply_id( $reply_id ); 2152 $topic_id = !empty( $topic_id ) ? bbp_get_topic_id( $topic_id ) : bbp_get_reply_topic_id( $reply_id ); 2153 $reply_hierarchical_position = 0; 2154 2155 // If reply is actually the first post in a topic, return 0 2156 if ( $reply_id != $topic_id ) { 2157 2158 // Make sure the topic has replies before running another query 2159 $reply_count = bbp_get_topic_reply_count( $topic_id, false ); 2160 if ( !empty( $reply_count ) ) { 2161 global $wpdb; 2162 2163 // Use ancestor for date calculations 2164 $ancestor_id = bbp_get_reply_ancestor_id( $reply_id ); 2165 $post_date_gmt = get_post_time( 'Y-m-d H:i:s', true, $ancestor_id ); 2166 2167 // Post stati 2168 $post_stati = array( 2169 bbp_get_public_status_id() 2170 ); 2171 2172 // Clean up for query 2173 $post_status_in_array = array(); 2174 foreach( $post_stati as $post_status ) 2175 $post_status_in_array[] = $wpdb->prepare( "%s", $post_status ); 2176 2177 // Join post statuses together 2178 $post_status_in_array = implode( ',', $post_status_in_array ); 2179 2180 // Direct SQL query for post meta values 2181 $sql = $wpdb->prepare( " 2182 SELECT COUNT(*) FROM {$wpdb->posts} p 2183 WHERE p.post_parent = %d 2184 AND p.post_type = %s 2185 AND p.post_date_gmt < %s 2186 AND p.post_status IN ( {$post_status_in_array} ) 2187 AND ( 2188 NOT EXISTS ( 2189 SELECT pm.* FROM {$wpdb->postmeta} pm WHERE p.ID = pm.post_id AND pm.meta_key = '_bbp_reply_to' 2190 ) OR EXISTS ( 2191 SELECT pm.* FROM {$wpdb->postmeta} pm WHERE p.ID = pm.post_id AND pm.meta_key = '_bbp_reply_to' AND pm.meta_value = 0 2192 ) OR EXISTS ( 2193 SELECT pm.* FROM {$wpdb->postmeta} pm WHERE p.ID = pm.post_id AND pm.meta_key = '_bbp_reply_to' AND pm.meta_value = %d 2194 ) ) ORDER BY p.post_date_gmt ASC", 2195 $topic_id, bbp_get_reply_post_type(), $post_date_gmt, $topic_id 2196 ); 2197 $reply_hierarchical_position = (int) $wpdb->get_var( $sql ); 2198 2199 // Bump the position to compensate for the lead topic post 2200 $reply_hierarchical_position++; 2201 } 2202 } 2203 2204 return (int) $reply_hierarchical_position; 2205 } -
includes/replies/template-tags.php
81 81 'paged' => bbp_get_paged(), // On this page 82 82 'orderby' => 'date', // Sorted by date 83 83 'order' => 'ASC', // Oldest to newest 84 'hierarchical' => false, // Hierarchical replies 84 85 's' => $default_reply_search, // Maybe search 85 86 ); 86 87 … … 113 114 // Parse arguments against default values 114 115 $r = bbp_parse_args( $args, $default, 'has_replies' ); 115 116 117 // Set posts_per_page value if replies are threaded 118 $replies_per_page = $r['posts_per_page']; 119 if ( $r['hierarchical'] ) { 120 $r['posts_per_page'] = -1; 121 } 122 116 123 // Get bbPress 117 124 $bbp = bbpress(); 118 125 119 126 // Call the query 120 127 $bbp->reply_query = new WP_Query( $r ); 121 128 122 129 // Add pagination values to query object 123 $bbp->reply_query->posts_per_page = $r ['posts_per_page'];130 $bbp->reply_query->posts_per_page = $replies_per_page; 124 131 $bbp->reply_query->paged = $r['paged']; 125 132 126 133 // Never home, regardless of what parse_query says … … 131 138 $bbp->reply_query->is_single = true; 132 139 } 133 140 141 // Only add reply to if query returned results 142 if ( (int) $bbp->reply_query->found_posts ) { 143 144 // Get reply to for each reply 145 foreach ( $bbp->reply_query->posts as &$post ) { 146 147 // Check for reply post type 148 if ( $post->post_type == bbp_get_reply_post_type() ) { 149 $reply_to = bbp_get_reply_to( $post->ID ); 150 151 // Make sure it's a reply to a reply 152 if ( empty( $reply_to ) || ( bbp_get_reply_topic_id( $post->ID ) == $reply_to ) ) 153 $reply_to = 0; 154 $post->reply_to = $reply_to; 155 } 156 } 157 } 158 134 159 // Only add pagination if query returned results 135 160 if ( (int) $bbp->reply_query->found_posts && (int) $bbp->reply_query->posts_per_page ) { 136 161 … … 157 182 $base = add_query_arg( 'paged', '%#%' ); 158 183 } 159 184 185 // Figure out total pages 186 if ( $r['hierarchical'] ) { 187 $walker = new Walker_Reply; 188 $total_pages = ceil( (int) $walker->get_number_of_root_elements( $bbp->reply_query->posts ) / (int) $replies_per_page ); 189 } else { 190 $total_pages = ceil( (int) $bbp->reply_query->found_posts / (int) $replies_per_page ); 191 } 192 160 193 // Add pagination to query object 161 194 $bbp->reply_query->pagination_links = paginate_links( 162 195 apply_filters( 'bbp_replies_pagination', array( 163 196 'base' => $base, 164 197 'format' => '', 165 'total' => ceil( (int) $bbp->reply_query->found_posts / (int) $r['posts_per_page'] ),198 'total' => $total_pages, 166 199 'current' => (int) $bbp->reply_query->paged, 167 200 'prev_text' => is_rtl() ? '→' : '←', 168 201 'next_text' => is_rtl() ? '←' : '→', … … 382 415 // Set needed variables 383 416 $reply_id = bbp_get_reply_id ( $reply_id ); 384 417 $topic_id = bbp_get_reply_topic_id( $reply_id ); 385 $reply_page = ceil( (int) bbp_get_reply_position( $reply_id, $topic_id ) / (int) bbp_get_replies_per_page() ); 418 419 // Hierarchical reply page 420 if ( bbp_thread_replies() ) { 421 $reply_page = ceil( (int) bbp_get_reply_hierarchical_position( $reply_id, $topic_id ) / (int) bbp_get_replies_per_page() ); 422 423 // Standard reply page 424 } else { 425 $reply_page = ceil( (int) bbp_get_reply_position( $reply_id, $topic_id ) / (int) bbp_get_replies_per_page() ); 426 } 427 386 428 $reply_hash = '#post-' . $reply_id; 387 429 $topic_link = bbp_get_topic_permalink( $topic_id, $redirect_to ); 388 430 $topic_url = remove_query_arg( 'view', $topic_link ); … … 1362 1404 } 1363 1405 1364 1406 /** 1407 * Output the reply's ancestor reply id 1408 * 1409 * @since bbPress (r####) 1410 * 1411 * @param int $reply_id Optional. Reply id 1412 * @uses bbp_get_reply_ancestor_id() To get the reply's ancestor id 1413 */ 1414 function bbp_reply_ancestor_id( $reply_id = 0 ) { 1415 echo bbp_get_reply_ancestor_id( $reply_id ); 1416 } 1417 /** 1418 * Return the reply's ancestor reply id 1419 * 1420 * @since bbPress (r####) 1421 * 1422 * @param in $reply_id Reply id 1423 * @uses bbp_get_reply_id() To get the reply id 1424 */ 1425 function bbp_get_reply_ancestor_id( $reply_id = 0 ) { 1426 1427 // Validation 1428 $reply_id = bbp_get_reply_id( $reply_id ); 1429 if ( empty( $reply_id ) ) 1430 return false; 1431 1432 // Find highest reply ancestor 1433 $ancestor_id = $reply_id; 1434 while ( $parent_id = bbp_get_reply_to( $ancestor_id ) ) { 1435 if ( empty( $parent_id ) || $parent_id == $ancestor_id || $parent_id == bbp_get_reply_topic_id( $reply_id ) || $parent_id == $reply_id ) 1436 break; 1437 $ancestor_id = $parent_id; 1438 } 1439 1440 return (int) $ancestor_id; 1441 } 1442 1443 /** 1444 * Output the reply to id of a reply 1445 * 1446 * @since bbPress (r####) 1447 * 1448 * @param int $reply_id Optional. Reply id 1449 * @uses bbp_get_reply_to() To get the reply to id 1450 */ 1451 function bbp_reply_to( $reply_id = 0 ) { 1452 echo bbp_get_reply_to( $reply_id ); 1453 } 1454 /** 1455 * Return the reply to id of a reply 1456 * 1457 * @since bbPress (r####) 1458 * 1459 * @param int $reply_id Optional. Reply id 1460 * @uses bbp_get_reply_id() To get the reply id 1461 * @uses get_post_meta() To get the reply to id 1462 * @uses apply_filters() Calls 'bbp_get_reply_to' with the reply to id and 1463 * reply id 1464 * @return int Reply's reply to id 1465 */ 1466 function bbp_get_reply_to( $reply_id = 0 ) { 1467 1468 // Assume there is no reply_to set 1469 $reply_to = 0; 1470 1471 // Check that reply_id is valid 1472 if ( $reply_id = bbp_get_reply_id( $reply_id ) ) 1473 1474 // Get reply_to value 1475 $reply_to = (int) get_post_meta( $reply_id, '_bbp_reply_to', true ); 1476 1477 return (int) apply_filters( 'bbp_get_reply_to', $reply_to, $reply_id ); 1478 } 1479 1480 /** 1481 * Output the link for the reply to 1482 * 1483 * @since bbPress (r####) 1484 * 1485 * @param array $args 1486 * @param int $reply 1487 * @uses bbp_get_reply_to_link() To get the reply to link 1488 */ 1489 function bbp_reply_to_link( $args = array(), $reply = 0 ) { 1490 echo bbp_get_reply_to_link( $args, $reply ); 1491 } 1492 1493 /** 1494 * Return the link for a reply to a reply 1495 * 1496 * @since bbPress (r####) 1497 * 1498 * @param array $args Arguments 1499 * @param int $reply_id Reply id 1500 * @uses bbp_current_user_can_access_create_reply_form() To check permissions 1501 * @uses bbp_get_reply_id() To validate the reply id 1502 * @uses bbp_get_reply() To get the reply 1503 * @uses apply_filters() Calls 'bbp_get_reply_to_link' with the formatted link, 1504 * the arguments array, and the reply 1505 * @return string Link for a reply to a reply 1506 */ 1507 function bbp_get_reply_to_link( $args = array(), $reply_id = 0 ) { 1508 1509 // Permissions check 1510 if ( !bbp_current_user_can_access_create_reply_form() ) 1511 return; 1512 1513 // Validate 1514 $reply_id = bbp_get_reply_id( $reply_id ); 1515 if ( empty( $reply_id ) ) 1516 $reply_id = bbp_get_reply_id(); 1517 1518 if ( empty( $reply_id ) ) 1519 return; 1520 1521 // Set defaults 1522 $reply = bbp_get_reply( $reply_id ); 1523 $defaults = array( 1524 'add_below' => 'reply', 1525 'respond_id' => 'new-reply-' . bbp_get_topic_id(), 1526 'reply_text' => __( 'Reply to this', 'bbpress' ), 1527 'depth' => 0, 1528 'before' => '', 1529 'after' => '' 1530 ); 1531 1532 $r = wp_parse_args( $args, $defaults ); 1533 1534 // Don't display for deeply nested replies 1535 if ( 0 == $r['depth'] || $r['max_depth'] <= $r['depth'] ) 1536 return; 1537 1538 // Non-JS compat 1539 remove_query_arg( array( 'bbp_reply_to' ) ); 1540 1541 // Assemble 1542 $link = "<a class='bbp-reply-to-link' href='" . esc_url( add_query_arg( array( 'bbp_reply_to' => $reply->ID ) ) ) . 1543 "#" . $r['respond_id'] . "' onclick='return addReply.moveForm(\"" . $r['add_below'] . '-' . $reply->ID . 1544 '","' . $reply->ID . '","' . $r['respond_id'] . '","' . $reply->post_parent . '")\'>' . $r['reply_text'] . '</a>'; 1545 1546 return apply_filters( 'bpp_get_reply_to_link', $link, $args, $reply ); 1547 } 1548 1549 /** 1550 * Output the reply to a reply cancellation link 1551 * 1552 * @since bbPress (r####) 1553 * 1554 * @uses bbp_get_cancel_reply_to_link() To get the reply cancellation link 1555 */ 1556 function bbp_cancel_reply_to_link( $text = '' ) { 1557 echo bbp_get_cancel_reply_to_link( $text ); 1558 } 1559 /** 1560 * Return the cancellation link for a reply to a reply 1561 * 1562 * @since bbPress (r####) 1563 * 1564 * @param string $text The cancel text 1565 * @uses apply_filters() Calls 'bbp_get_cancel_reply_to_link' with the cancellation 1566 * link and the cancel text 1567 * @return string The cancellation link 1568 */ 1569 function bbp_get_cancel_reply_to_link( $text = '' ) { 1570 1571 // Set default text 1572 if ( empty( $text ) ) 1573 $text = __( 'Click here to cancel reply.', 'bbpress' ); 1574 1575 // Set visibility 1576 $style = isset( $_GET['bbp_reply_to'] ) ? '' : ' style="display:none;"'; 1577 $link = esc_html( remove_query_arg( array( 'bbp_reply_to' ) ) ) . '#respond'; 1578 1579 return apply_filters( 'bbp_get_cancel_reply_to_link', '<a rel="nofollow" id="bbp-cancel-reply-to-link" href="' . $link . '"' . $style . '>' . $text . '</a>', $link, $text ); 1580 } 1581 1582 /** 1365 1583 * Output the numeric position of a reply within a topic 1366 1584 * 1367 1585 * @since bbPress (r2984) … … 1424 1642 return (int) apply_filters( 'bbp_get_reply_position', $reply_position, $reply_id, $topic_id ); 1425 1643 } 1426 1644 1645 /** 1646 * Output the numeric position of a threaded reply within a topic 1647 * 1648 * @since bbPress (r####) 1649 * 1650 * @param int $reply_id Optional. Reply id 1651 * @param int $topic_id Optional. Topic id 1652 * @uses bbp_get_reply_hierarchical_position() To get the reply position 1653 */ 1654 function bbp_reply_hierarchical_position( $reply_id = 0, $topic_id = 0 ) { 1655 echo bbp_get_reply_hierarchical_position( $reply_id, $topic_id ); 1656 } 1657 1658 /** 1659 * Return the numeric position of a threaded reply within a topic. Technically, 1660 * get the position of the reply's ancestor in the context of other top-level 1661 * replies to the topic. 1662 * 1663 * @since bbPress (r####) 1664 * 1665 * @param int $reply_id Optional. Reply id 1666 * @param int $topic_id Optional. Topic id 1667 * @uses bbp_get_reply_id() To get the reply id 1668 * @uses bbp_get_reply_topic_id() Get the topic id of the reply id 1669 * @uses bbp_get_reply_hierarchical_position_raw() To get calculate the reply position 1670 * @uses bbp_update_reply_hierarchical_position() To update the reply position 1671 * @uses bbp_show_lead_topic() Bump the count if lead topic is included 1672 * @uses apply_filters() Calls 'bbp_get_reply_hierarchical_position' with the reply 1673 * position, reply id and topic id 1674 * @return int Reply hierarchical position 1675 */ 1676 function bbp_get_reply_hierarchical_position( $reply_id = 0, $topic_id = 0 ) { 1677 1678 // Validate 1679 $reply_id = bbp_get_reply_id( $reply_id ); 1680 $reply_hierarchical_position = get_post_meta( '_bbp_reply_position', $reply_id ); 1681 1682 // Calculate and save the position 1683 if ( empty( $reply_hierarchical_position ) ) { 1684 $topic_id = !empty( $topic_id ) ? bbp_get_topic_id( $topic_id ) : bbp_get_reply_topic_id( $reply_id ); 1685 1686 // Post is not the topic 1687 if ( $reply_id != $topic_id ) { 1688 $reply_hierarchical_position = bbp_get_reply_hierarchical_position_raw( $reply_id, $topic_id ); 1689 1690 // Update the reply position in the posts table to avoid expensive 1691 // queries. 1692 if ( !empty( $reply_hierarchical_position ) ) { 1693 bbp_update_reply_hierarchical_position( $reply_id, $reply_hierarchical_position ); 1694 } 1695 1696 // Topic's position is always 0 1697 } else { 1698 $reply_hierarchical_position = 0; 1699 } 1700 } 1701 1702 // Bump the position by one if the lead topic is in the replies loop 1703 if ( ! bbp_show_lead_topic() ) 1704 $reply_hierarchical_position++; 1705 1706 return (int) apply_filters( 'bbp_get_reply_hierarchical_position', $reply_hierarchical_position, $reply_id, $topic_id ); 1707 } 1708 1427 1709 /** Reply Admin Links *********************************************************/ 1428 1710 1429 1711 /** … … 2091 2373 } 2092 2374 2093 2375 /** 2376 * Output the value of the reply to field 2377 * 2378 * @since bbPress (r####) 2379 * 2380 * @uses bbp_get_form_reply_to() To get value of the reply to field 2381 */ 2382 function bbp_form_reply_to() { 2383 echo bbp_get_form_reply_to(); 2384 } 2385 2386 /** 2387 * Return the value of reply to field 2388 * 2389 * @since bbPress (r####) 2390 * 2391 * @uses bbp_get_reply_id() To validate the reply to 2392 * @uses apply_filters() Calls 'bbp_get_form_reply_to' with the reply to 2393 * @return string Value of reply to field 2394 */ 2395 function bbp_get_form_reply_to() { 2396 2397 // Set initial value 2398 $reply_to = 0; 2399 2400 // Get $_REQUEST data 2401 if ( isset( $_REQUEST['bbp_reply_to'] ) ) 2402 $reply_to = (int) $_REQUEST['bbp_reply_to']; 2403 2404 // If empty, get from meta 2405 if ( empty( $reply_to ) ) 2406 $reply_to = bbp_get_reply_to(); 2407 2408 // Validate 2409 $reply_to = bbp_get_reply_id( $reply_to ); 2410 2411 return (int) apply_filters( 'bbp_get_form_reply_to', $reply_to ); 2412 } 2413 2414 /** 2094 2415 * Output checked value of reply log edit field 2095 2416 * 2096 2417 * @since bbPress (r31301) -
includes/topics/functions.php
1232 1232 bbp_update_reply_topic_id( $reply->ID, $destination_topic->ID ); 1233 1233 bbp_update_reply_forum_id( $reply->ID, bbp_get_topic_forum_id( $destination_topic->ID ) ); 1234 1234 1235 // Adjust reply to values 1236 $reply_to = bbp_get_reply_to( $reply->ID ); 1237 if ( empty( $reply_to ) ) 1238 bbp_update_reply_to( $reply->ID, $source_topic->ID ); 1239 1235 1240 // Do additional actions per merged reply 1236 1241 do_action( 'bbp_merged_topic_reply', $reply->ID, $destination_topic->ID ); 1237 1242 } … … 1565 1570 break; 1566 1571 } 1567 1572 1573 // Save reply ids 1574 $reply_ids = array(); 1575 1568 1576 // Change the post_parent of each reply to the destination topic id 1569 1577 foreach ( $replies as $reply ) { 1570 1578 … … 1584 1592 // Update the reply 1585 1593 wp_update_post( $postarr ); 1586 1594 1595 // Gather reply ids 1596 $reply_ids[] = $reply->ID; 1597 1587 1598 // Adjust reply meta values 1588 1599 bbp_update_reply_topic_id( $reply->ID, $destination_topic->ID ); 1589 1600 bbp_update_reply_forum_id( $reply->ID, bbp_get_topic_forum_id( $destination_topic->ID ) ); 1590 1601 1602 // Adjust reply to values 1603 $reply_to = bbp_get_reply_to( $reply->ID ); 1604 1605 // Not a reply to a reply that moved over 1606 if ( !in_array( $reply_to, $reply_ids ) ) 1607 bbp_update_reply_to( $reply->ID, 0 ); 1608 1609 // New topic from reply can't be a reply to 1610 if ( ( $from_reply->ID == $destination_topic->ID && $from_reply->ID == $reply_to ) ) 1611 bbp_update_reply_to( $reply->ID, 0 ); 1612 1591 1613 // Do additional actions per split reply 1592 1614 do_action( 'bbp_split_topic_reply', $reply->ID, $destination_topic->ID ); 1593 1615 } 1594 1616 1617 // Remove reply to from new topic 1618 if ( $from_reply->ID == $destination_topic->ID ) 1619 delete_post_meta( $from_reply->ID, '_bbp_reply_to' ); 1620 1595 1621 // Set the last reply ID and freshness 1596 1622 $last_reply_id = $reply->ID; 1597 1623 $freshness = $reply->post_date; -
templates/default/bbpress/content-single-topic.php
31 31 32 32 <?php endif; ?> 33 33 34 <?php if ( bbp_has_replies( ) ) : ?>34 <?php if ( bbp_has_replies( array( 'hierarchical' => bbp_thread_replies() ) ) ) : ?> 35 35 36 36 <?php bbp_get_template_part( 'pagination', 'replies' ); ?> 37 37 -
templates/default/bbpress/form-reply.php
28 28 <fieldset class="bbp-form"> 29 29 <legend><?php printf( __( 'Reply To: %s', 'bbpress' ), bbp_get_topic_title() ); ?></legend> 30 30 31 <?php if ( bbp_thread_replies() && !bbp_is_reply_edit() ) : ?> 32 33 <div id="bbp-cancel-reply-to"><?php bbp_cancel_reply_to_link(); ?></div> 34 35 <?php endif; ?> 36 31 37 <?php do_action( 'bbp_theme_before_reply_form_notices' ); ?> 32 38 33 39 <?php if ( !bbp_is_topic_open() && !bbp_is_reply_edit() ) : ?> -
templates/default/bbpress/loop-replies.php
39 39 40 40 <li class="bbp-body"> 41 41 42 <?php while ( bbp_replies() ) : bbp_the_reply();?>42 <?php if ( bbp_thread_replies() ) : ?> 43 43 44 <?php bbp_ get_template_part( 'loop', 'single-reply'); ?>44 <?php bbp_list_replies(); ?> 45 45 46 <?php e ndwhile;?>46 <?php else : ?> 47 47 48 <?php while ( bbp_replies() ) : bbp_the_reply(); ?> 49 50 <?php bbp_get_template_part( 'loop', 'single-reply' ); ?> 51 52 <?php endwhile; ?> 53 54 <?php endif; ?> 55 48 56 </li><!-- .bbp-body --> 49 57 50 58 <li class="bbp-footer"> -
templates/default/bbpress/pagination-replies.php
12 12 <?php do_action( 'bbp_template_before_pagination_loop' ); ?> 13 13 14 14 <div class="bbp-pagination"> 15 <div class="bbp-pagination-count">16 15 17 <?php bbp_topic_pagination_count();?>16 <?php if ( !bbp_thread_replies() ) : ?> 18 17 19 </div>18 <div class="bbp-pagination-count"> 20 19 20 <?php bbp_topic_pagination_count(); ?> 21 22 </div> 23 24 <?php endif; ?> 25 21 26 <div class="bbp-pagination-links"> 22 27 23 28 <?php bbp_topic_pagination_links(); ?> -
templates/default/bbpress-functions.php
179 179 wp_enqueue_script( 'jquery' ); 180 180 } 181 181 182 // Topic favorite/subscribe182 // Topic-specific scripts 183 183 if ( bbp_is_single_topic() ) { 184 185 // Topic favorite/unsubscribe 184 186 wp_enqueue_script( 'bbpress-topic', $this->url . 'js/topic.js', array( 'jquery' ), $this->version ); 187 188 // Hierarchical replies 189 if ( bbp_thread_replies() ) 190 wp_enqueue_script( 'bbpress-reply', $this->url . 'js/reply.js', array(), $this->version ); 185 191 } 186 192 187 193 // User Profile edit -
templates/default/css/bbpress-rtl.css
60 60 padding: 0; 61 61 } 62 62 63 #bbpress-forums ul.children { 64 margin-right: 2em; 65 } 66 63 67 #bbpress-forums li { 64 68 margin: 0; 65 69 list-style: none; … … 345 349 background-color: transparent; 346 350 } 347 351 352 /* =Reply to 353 -------------------------------------------------------------- */ 354 355 #bbpress-forums div.bbp-reply-to { 356 margin-right: 130px; 357 padding: 12px 0px 12px 12px; 358 text-align: left; 359 } 360 361 #bbpress-forums div#bbp-cancel-reply-to { 362 text-align: left; 363 } 364 348 365 /* =Breadcrumb and Tags 349 366 -------------------------------------------------------------- */ 350 367 -
templates/default/css/bbpress.css
60 60 padding: 0; 61 61 } 62 62 63 #bbpress-forums ul.children { 64 margin-left: 2em; 65 } 66 63 67 #bbpress-forums li { 64 68 margin: 0; 65 69 list-style: none; … … 345 349 background-color: transparent; 346 350 } 347 351 352 /* =Reply to 353 -------------------------------------------------------------- */ 354 355 #bbpress-forums div.bbp-reply-to { 356 margin-left: 130px; 357 padding: 12px 12px 12px 0; 358 text-align: right; 359 } 360 361 #bbpress-forums div#bbp-cancel-reply-to { 362 text-align: right; 363 } 364 348 365 /* =Breadcrumb and Tags 349 366 -------------------------------------------------------------- */ 350 367 -
templates/default/js/reply.js
1 addReply = { 2 moveForm : function(replyId, parentId, respondId, postId) { 3 var t = this, div, reply = t.I(replyId), respond = t.I(respondId), cancel = t.I('bbp-cancel-reply-to-link'), parent = t.I('bbp_reply_to'), post = t.I('bbp_topic_id'); 4 5 if ( ! reply || ! respond || ! cancel || ! parent ) 6 return; 7 8 t.respondId = respondId; 9 postId = postId || false; 10 11 if ( ! t.I('bbp-temp-form-div') ) { 12 div = document.createElement('div'); 13 div.id = 'bbp-temp-form-div'; 14 div.style.display = 'none'; 15 respond.parentNode.insertBefore(div, respond); 16 } 17 18 reply.parentNode.insertBefore(respond, reply.nextSibling); 19 if ( post && postId ) 20 post.value = postId; 21 parent.value = parentId; 22 cancel.style.display = ''; 23 24 cancel.onclick = function() { 25 var t = addReply, temp = t.I('bbp-temp-form-div'), respond = t.I(t.respondId); 26 27 if ( ! temp || ! respond ) 28 return; 29 30 t.I('bbp_reply_to').value = '0'; 31 temp.parentNode.insertBefore(respond, temp); 32 temp.parentNode.removeChild(temp); 33 this.style.display = 'none'; 34 this.onclick = null; 35 return false; 36 } 37 38 try { t.I('bbp_reply_content').focus(); } 39 catch(e) {} 40 41 return false; 42 }, 43 44 I : function(e) { 45 return document.getElementById(e); 46 } 47 }