Changeset 3295 for branches/plugin/bbp-admin/bbp-replies.php
- Timestamp:
- 06/02/2011 07:22:58 PM (15 years ago)
- File:
-
- 1 edited
-
branches/plugin/bbp-admin/bbp-replies.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-replies.php
r3286 r3295 231 231 return $reply_id; 232 232 233 // Check action exists 234 if ( empty( $_POST['action'] ) ) 235 return $reply_id; 236 237 // Bail if post_type is not a topic or reply 238 if ( get_post_type( $reply_id ) != $this->post_type ) 239 return; 240 233 241 // Current user cannot edit this reply 234 242 if ( !current_user_can( 'edit_reply', $reply_id ) ) 235 243 return $reply_id; 236 244 237 // Load the reply 238 if ( !$reply = bbp_get_reply( $reply_id ) ) 239 return $reply_id; 240 241 // OK, we're authenticated: we need to find and save the data 242 $parent_id = isset( $reply->parent_id ) ? $reply->parent_id : 0; 243 244 do_action( 'bbp_reply_attributes_metabox_save', $reply_id, $parent_id ); 245 246 return $parent_id; 245 // Get the reply meta post values 246 $topic_id = !empty( $_POST['parent_id'] ) ? (int) $_POST['parent_id'] : 0; 247 $forum_id = !empty( $_POST['bbp_forum_id'] ) ? (int) $_POST['bbp_forum_id'] : bbp_get_topic_forum_id( $topic_id ); 248 249 // Formally update the reply 250 bbp_update_reply( $reply_id, $topic_id, $forum_id ); 251 252 // Allow other fun things to happen 253 do_action( 'bbp_reply_attributes_metabox_save', $reply_id, $topic_id, $forum_id ); 254 255 return $reply_id; 247 256 } 248 257 … … 585 594 echo $topic_title; 586 595 587 // Show actions if topic exists588 if ( $topic_title != __( 'No Topic', 'bbpress' ) ) {589 590 // Link information591 $actions = apply_filters( 'reply_topic_row_actions', array (592 'edit' => '<a href="' . add_query_arg( array( 'post' => $topic_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',593 'view' => '<a href="' . bbp_get_topic_permalink( $topic_id ) . '">' . __( 'View', 'bbpress' ) . '</a>'594 ) );595 596 // Output forum post row links597 foreach ( $actions as $action => $link )598 $formatted_actions[] = '<span class="' . $action . '">' . $link . '</span>';599 600 echo '<div class="row-actions">' . implode( ' | ', $formatted_actions ) . '</div>';601 }602 603 596 // Reply has no topic 604 597 } else { … … 611 604 case 'bbp_reply_forum' : 612 605 613 // Get Forum ID 614 $forum_id = bbp_get_topic_forum_id( $topic_id ); 606 // Get Forum ID's 607 $reply_forum_id = bbp_get_reply_forum_id( $reply_id ); 608 $topic_forum_id = bbp_get_topic_forum_id( $topic_id ); 615 609 616 610 // Output forum name 617 if ( !empty( $ forum_id ) ) {611 if ( !empty( $reply_forum_id ) ) { 618 612 619 613 // Forum Title 620 if ( !$forum_title = bbp_get_forum_title( $ forum_id ) )614 if ( !$forum_title = bbp_get_forum_title( $reply_forum_id ) ) 621 615 $forum_title = __( 'No Forum', 'bbpress' ); 616 617 // Alert capable users of reply forum mismatch 618 if ( $reply_forum_id != $topic_forum_id ) { 619 if ( current_user_can( 'edit_others_replies' ) || current_user_can( 'moderate' ) ) { 620 $forum_title .= '<div class="attention">' . __( '(Mismatch)', 'bbpress' ) . '</div>'; 621 } 622 } 622 623 623 624 // Output the title 624 625 echo $forum_title; 625 626 // Show actions if forum exists 627 if ( $forum_title != __( 'No Forum', 'bbpress' ) ) { 628 629 // Link information 630 $actions = apply_filters( 'reply_topic_forum_row_actions', array ( 631 'edit' => '<a href="' . add_query_arg( array( 'post' => $forum_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>', 632 'view' => '<a href="' . bbp_get_forum_permalink( $forum_id ) . '">' . __( 'View', 'bbpress' ) . '</a>' 633 ) ); 634 635 // Output forum post row links 636 foreach ( $actions as $action => $link ) 637 $formatted_actions[] = '<span class="' . $action . '">' . $link . '</span>'; 638 639 // Show forum actions 640 echo '<div class="row-actions">' . implode( ' | ', $formatted_actions ) . '</div>'; 641 } 642 626 643 627 // Reply has no forum 644 628 } else {
Note: See TracChangeset
for help on using the changeset viewer.