Ticket #1900: 1900.1.diff
| File 1900.1.diff, 28.7 KB (added by , 14 years ago) |
|---|
-
includes/topics/template-tags.php
133 133 // Set post_parent back to 0 if originally set to 'any' 134 134 if ( 'any' == $r['post_parent'] ) 135 135 $r['post_parent'] = $post_parent = 0; 136 else 137 $post_parent = $r['post_parent']; 136 138 137 139 // Limited the number of pages shown 138 140 if ( !empty( $r['max_num_pages'] ) ) -
includes/topics/functions.php
1663 1663 function bbp_split_topic_count( $from_reply_id, $source_topic_id, $destination_topic_id ) { 1664 1664 1665 1665 // Forum Topic Counts 1666 bbp_update_forum_topic_count( $destination_topic_id);1666 bbp_update_forum_topic_count( bbp_get_topic_forum_id( $destination_topic_id ) ); 1667 1667 1668 1668 // Forum Reply Counts 1669 bbp_update_forum_reply_count( $destination_topic_id);1669 bbp_update_forum_reply_count( bbp_get_topic_forum_id( $destination_topic_id ) ); 1670 1670 1671 1671 // Topic Reply Counts 1672 1672 bbp_update_topic_reply_count( $source_topic_id ); -
includes/replies/template-tags.php
1410 1410 * - after: HTML after the links. Defaults to '</span>' 1411 1411 * - sep: Separator. Defaults to ' | ' 1412 1412 * - links: Array of the links to display. By default, edit, trash, 1413 * spam and topic split links are displayed1413 * spam, reply move, and topic split links are displayed 1414 1414 * @uses bbp_is_topic() To check if it's the topic page 1415 1415 * @uses bbp_is_reply() To check if it's the reply page 1416 1416 * @uses bbp_get_reply_id() To get the reply id 1417 1417 * @uses bbp_get_reply_edit_link() To get the reply edit link 1418 1418 * @uses bbp_get_reply_trash_link() To get the reply trash link 1419 1419 * @uses bbp_get_reply_spam_link() To get the reply spam link 1420 * @uses bbp_get_reply_move_link() To get the reply move link 1420 1421 * @uses bbp_get_topic_split_link() To get the topic split link 1421 1422 * @uses current_user_can() To check if the current user can edit or 1422 1423 * delete the reply … … 1457 1458 if ( empty( $r['links'] ) ) { 1458 1459 $r['links'] = array ( 1459 1460 'edit' => bbp_get_reply_edit_link ( $r ), 1461 'move' => bbp_get_reply_move_link ( $r ), 1460 1462 'split' => bbp_get_topic_split_link( $r ), 1461 1463 'trash' => bbp_get_reply_trash_link( $r ), 1462 1464 'spam' => bbp_get_reply_spam_link ( $r ), … … 1739 1741 } 1740 1742 1741 1743 /** 1744 * Move reply link 1745 * 1746 * Output the move link of the reply 1747 * 1748 * @param mixed $args See {@link bbp_get_reply_move_link()} 1749 * @uses bbp_get_reply_move_link() To get the reply move link 1750 */ 1751 function bbp_reply_move_link( $args = '' ) { 1752 echo bbp_get_reply_move_link( $args ); 1753 } 1754 1755 /** 1756 * Get move reply link 1757 * 1758 * Return the move link of the reply 1759 * 1760 * @param mixed $args This function supports these arguments: 1761 * - id: Reply id 1762 * - link_before: HTML before the link 1763 * - link_after: HTML after the link 1764 * - move_text: Move text 1765 * - move_title: Move title attribute 1766 * @uses bbp_get_reply_id() To get the reply id 1767 * @uses bbp_get_reply() To get the reply 1768 * @uses current_user_can() To check if the current user can edit the 1769 * topic 1770 * @uses bbp_get_reply_topic_id() To get the reply topic id 1771 * @uses bbp_get_reply_edit_url() To get the reply edit url 1772 * @uses add_query_arg() To add custom args to the url 1773 * @uses wp_nonce_url() To nonce the url 1774 * @uses esc_url() To escape the url 1775 * @uses apply_filters() Calls 'bbp_get_reply_move_link' with the reply 1776 * move link and args 1777 * @return string Reply move link 1778 */ 1779 function bbp_get_reply_move_link( $args = '' ) { 1780 1781 // Parse arguments against default values 1782 $r = bbp_parse_args( $args, array( 1783 'id' => 0, 1784 'link_before' => '', 1785 'link_after' => '', 1786 'split_text' => __( 'Move', 'bbpress' ), 1787 'split_title' => __( 'Move this reply', 'bbpress' ) 1788 ), 'get_reply_move_link' ); 1789 1790 $reply_id = bbp_get_reply_id( $r['id'] ); 1791 $topic_id = bbp_get_reply_topic_id( $reply_id ); 1792 1793 if ( empty( $reply_id ) || !current_user_can( 'moderate', $topic_id ) ) 1794 return; 1795 1796 $uri = esc_url( 1797 add_query_arg( 1798 array( 1799 'action' => 'move', 1800 'reply_id' => $reply_id 1801 ), 1802 bbp_get_reply_edit_url( $reply_id ) 1803 ) ); 1804 1805 $retval = $r['link_before'] . '<a href="' . $uri . '" title="' . esc_attr( $r['split_title'] ) . '">' . esc_html( $r['split_text'] ) . '</a>' . $r['link_after']; 1806 1807 return apply_filters( 'bbp_get_reply_move_link', $retval, $r ); 1808 } 1809 1810 1811 /** 1742 1812 * Split topic link 1743 1813 * 1744 * Output the split link of the topic (but is bundled with each topic)1814 * Output the split link of the topic (but is bundled with each reply) 1745 1815 * 1746 1816 * @since bbPress (r2756) 1747 1817 * … … 1776 1846 * @uses esc_url() To escape the url 1777 1847 * @uses apply_filters() Calls 'bbp_get_topic_split_link' with the topic 1778 1848 * split link and args 1779 * @return string Reply spamlink1849 * @return string Topic split link 1780 1850 */ 1781 1851 function bbp_get_topic_split_link( $args = '' ) { 1782 1852 -
includes/replies/functions.php
1010 1010 return apply_filters( 'bbp_update_reply_revision_log', $revision_log, $r['reply_id'] ); 1011 1011 } 1012 1012 1013 /** 1014 * Move reply handler 1015 * 1016 * Handles the front end move reply submission 1017 * 1018 * @uses bbPress:errors::add() To log various error messages 1019 * @uses bbp_get_reply() To get the reply 1020 * @uses bbp_get_topic() To get the topics 1021 * @uses bbp_verify_nonce_request() To verify the nonce and check the request 1022 * @uses current_user_can() To check if the current user can edit the reply and topics 1023 * @uses bbp_get_topic_post_type() To get the topic post type 1024 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error} 1025 * @uses do_action() Calls 'bbp_pre_move_reply' with the from reply id, source 1026 * and destination topic ids 1027 * @uses bbp_get_reply_post_type() To get the reply post type 1028 * @uses wpdb::prepare() To prepare our sql query 1029 * @uses wpdb::get_results() To execute the sql query and get results 1030 * @uses wp_update_post() To update the replies 1031 * @uses bbp_update_reply_topic_id() To update the reply topic id 1032 * @uses bbp_get_topic_forum_id() To get the topic forum id 1033 * @uses bbp_update_reply_forum_id() To update the reply forum id 1034 * @uses do_action() Calls 'bbp_split_topic_reply' with the reply id and 1035 * destination topic id 1036 * @uses bbp_update_topic_last_reply_id() To update the topic last reply id 1037 * @uses bbp_update_topic_last_active_time() To update the topic last active meta 1038 * @uses do_action() Calls 'bbp_post_split_topic' with the destination and 1039 * source topic ids and source topic's forum id 1040 * @uses bbp_get_topic_permalink() To get the topic permalink 1041 * @uses wp_safe_redirect() To redirect to the topic link 1042 */ 1043 function bbp_move_reply_handler() { 1044 1045 // Bail if not a POST action 1046 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 1047 return; 1048 1049 // Bail if action is not 'bbp-move-reply' 1050 if ( empty( $_POST['action'] ) || ( 'bbp-move-reply' !== $_POST['action'] ) ) 1051 return; 1052 1053 global $wpdb; 1054 1055 // Prevent debug notices 1056 $move_reply_id = $destination_topic_id = 0; 1057 $destination_topic_title = ''; 1058 $destination_topic = $move_reply = $source_topic = ''; 1059 $split_option = false; 1060 1061 /** Move Reply ***********************************************************/ 1062 1063 if ( empty( $_POST['bbp_reply_id'] ) ) 1064 bbp_add_error( 'bbp_move_reply_reply_id', __( '<strong>ERROR</strong>: Reply ID to move not found!', 'bbpress' ) ); 1065 else 1066 $move_reply_id = (int) $_POST['bbp_reply_id']; 1067 1068 $move_reply = bbp_get_reply( $move_reply_id ); 1069 1070 // Reply exists 1071 if ( empty( $move_reply ) ) 1072 bbp_add_error( 'bbp_mover_reply_r_not_found', __( '<strong>ERROR</strong>: The reply you want to move was not found.', 'bbpress' ) ); 1073 1074 /** Topic to Move From ***************************************************/ 1075 1076 // Get the reply's current topic 1077 $source_topic = bbp_get_topic( $move_reply->post_parent ); 1078 1079 // No topic 1080 if ( empty( $source_topic ) ) 1081 bbp_add_error( 'bbp_move_reply_source_not_found', __( '<strong>ERROR</strong>: The topic you want to move from was not found.', 'bbpress' ) ); 1082 1083 // Nonce check failed 1084 if ( ! bbp_verify_nonce_request( 'bbp-move-reply_' . $move_reply->ID ) ) { 1085 bbp_add_error( 'bbp_move_reply_nonce', __( '<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress' ) ); 1086 return; 1087 } 1088 1089 // Use cannot edit topic 1090 if ( !current_user_can( 'edit_topic', $source_topic->ID ) ) 1091 bbp_add_error( 'bbp_move_reply_source_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the source topic.', 'bbpress' ) ); 1092 1093 // How to move 1094 if ( !empty( $_POST['bbp_reply_move_option'] ) ) 1095 $move_option = (string) trim( $_POST['bbp_reply_move_option'] ); 1096 1097 // Invalid move option 1098 if ( empty( $move_option ) || !in_array( $move_option, array( 'existing', 'topic' ) ) ) { 1099 bbp_add_error( 'bbp_move_reply_option', __( '<strong>ERROR</strong>: You need to choose a valid move option.', 'bbpress' ) ); 1100 1101 // Valid move option 1102 } else { 1103 1104 // What kind of move 1105 switch ( $move_option ) { 1106 1107 // Into an existing topic 1108 case 'existing' : 1109 1110 // Get destination topic id 1111 if ( empty( $_POST['bbp_destination_topic'] ) ) 1112 bbp_add_error( 'bbp_move_reply_destination_id', __( '<strong>ERROR</strong>: Destination topic ID not found!', 'bbpress' ) ); 1113 else 1114 $destination_topic_id = (int) $_POST['bbp_destination_topic']; 1115 1116 // Get the destination topic 1117 $destination_topic = bbp_get_topic( $destination_topic_id ); 1118 1119 // No destination topic 1120 if ( empty( $destination_topic ) ) 1121 bbp_add_error( 'bbp_move_reply_destination_not_found', __( '<strong>ERROR</strong>: The topic you want to move to was not found!', 'bbpress' ) ); 1122 1123 // User cannot edit the destination topic 1124 if ( !current_user_can( 'edit_topic', $destination_topic->ID ) ) 1125 bbp_add_error( 'bbp_move_reply_destination_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the destination topic!', 'bbpress' ) ); 1126 1127 // Reply position 1128 $reply_position = bbp_get_topic_reply_count( $destination_topic->ID ) + 1; 1129 1130 // New reply data 1131 $postarr = array( 1132 'ID' => $move_reply->ID, 1133 'post_title' => sprintf( __( 'Reply To: %s', 'bbpress' ), $destination_topic->post_title ), 1134 'post_name' => false, // will be automatically generated 1135 'post_parent' => $destination_topic->ID, 1136 'post_position' => $reply_position, 1137 'guid' => '' 1138 ); 1139 1140 // Update the reply 1141 wp_update_post( $postarr ); 1142 1143 // Adjust reply meta values 1144 bbp_update_reply_topic_id( $move_reply->ID, $destination_topic->ID ); 1145 bbp_update_reply_forum_id( $move_reply->ID, bbp_get_topic_forum_id( $destination_topic->ID ) ); 1146 1147 break; 1148 1149 // Move reply to a new topic 1150 case 'topic' : 1151 default : 1152 1153 // User needs to be able to publish topics 1154 if ( current_user_can( 'publish_topics' ) ) { 1155 1156 // Use the new title that was passed 1157 if ( !empty( $_POST['bbp_reply_move_destination_title'] ) ) { 1158 $destination_topic_title = esc_attr( strip_tags( $_POST['bbp_reply_move_destination_title'] ) ); 1159 1160 // Use the source topic title 1161 } else { 1162 $destination_topic_title = $source_topic->post_title; 1163 } 1164 1165 // Setup the updated topic parameters 1166 $postarr = array( 1167 'ID' => $move_reply->ID, 1168 'post_title' => $destination_topic_title, 1169 'post_name' => false, 1170 'post_type' => bbp_get_topic_post_type(), 1171 'post_parent' => $source_topic->post_parent, 1172 'guid' => '' 1173 ); 1174 1175 // Update the topic 1176 $destination_topic_id = wp_update_post( $postarr ); 1177 $destination_topic = bbp_get_topic( $destination_topic_id ); 1178 1179 // Make sure the new topic knows its a topic 1180 bbp_update_topic_topic_id( $move_reply->ID ); 1181 1182 // Shouldn't happen 1183 if ( false == $destination_topic_id || is_wp_error( $destination_topic_id ) || empty( $destination_topic ) ) { 1184 bbp_add_error( 'bbp_move_reply_destination_reply', __( '<strong>ERROR</strong>: There was a problem converting the reply into the topic. Please try again.', 'bbpress' ) ); 1185 } 1186 1187 // User cannot publish posts 1188 } else { 1189 bbp_add_error( 'bbp_move_reply_destination_permission', __( '<strong>ERROR</strong>: You do not have the permissions to create new topics. The reply could not be converted into a topic.', 'bbpress' ) ); 1190 } 1191 1192 break; 1193 } 1194 } 1195 1196 // Bail if there are errors 1197 if ( bbp_has_errors() ) 1198 return; 1199 1200 /** No Errors - Clean Up **************************************************/ 1201 1202 // Update counts, etc... 1203 do_action( 'bbp_pre_move_reply', $move_reply->ID, $source_topic->ID, $destination_topic->ID ); 1204 1205 /** Date Check ************************************************************/ 1206 1207 // Check if the destination topic is older than the move reply 1208 if ( strtotime( $move_reply->post_date ) < strtotime( $destination_topic->post_date ) ) { 1209 1210 // Set destination topic post_date to 1 second before from reply 1211 $destination_post_date = date( 'Y-m-d H:i:s', strtotime( $move_reply->post_date ) - 1 ); 1212 1213 $postarr = array( 1214 'ID' => $destination_topic_id, 1215 'post_date' => $destination_post_date, 1216 'post_date_gmt' => get_gmt_from_date( $destination_post_date ) 1217 ); 1218 1219 // Update destination topic 1220 wp_update_post( $postarr ); 1221 } 1222 1223 // Set the last reply ID and freshness to the move_reply 1224 $last_reply_id = $move_reply->ID; 1225 $freshness = $move_reply->post_date; 1226 1227 // It is a new topic and we need to set some default metas to make 1228 // the topic display in bbp_has_topics() list 1229 if ( 'topic' == $move_option ) { 1230 bbp_update_topic_last_reply_id ( $destination_topic->ID, $last_reply_id ); 1231 bbp_update_topic_last_active_id ( $destination_topic->ID, $last_reply_id ); 1232 bbp_update_topic_last_active_time( $destination_topic->ID, $freshness ); 1233 1234 // Otherwise update the existing destination topic 1235 } else { 1236 bbp_update_topic_last_reply_id ( $destination_topic->ID ); 1237 bbp_update_topic_last_active_id ( $destination_topic->ID ); 1238 bbp_update_topic_last_active_time( $destination_topic->ID ); 1239 } 1240 1241 // Update source topic ID last active 1242 bbp_update_topic_last_reply_id ( $source_topic->ID ); 1243 bbp_update_topic_last_active_id ( $source_topic->ID ); 1244 bbp_update_topic_last_active_time( $source_topic->ID ); 1245 1246 /** Successful Move ******************************************************/ 1247 1248 // Update counts, etc... 1249 do_action( 'bbp_post_move_reply', $move_reply->ID, $source_topic->ID, $destination_topic->ID ); 1250 1251 // Redirect back to the topic 1252 wp_safe_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); 1253 1254 // For good measure 1255 exit(); 1256 } 1257 1258 /** 1259 * Fix counts on reply move 1260 * 1261 * When a reply is moved, update the counts of source and destination topic 1262 * and their forums. 1263 * 1264 * @param int $move_reply_id Move reply id 1265 * @param int $source_topic_id Source topic id 1266 * @param int $destination_topic_id Destination topic id 1267 * @uses bbp_update_forum_topic_count() To update the forum topic counts 1268 * @uses bbp_update_forum_reply_count() To update the forum reply counts 1269 * @uses bbp_update_topic_reply_count() To update the topic reply counts 1270 * @uses bbp_update_topic_voice_count() To update the topic voice counts 1271 * @uses bbp_update_topic_reply_count_hidden() To update the topic hidden reply 1272 * count 1273 * @uses do_action() Calls 'bbp_move_reply_count' with the move reply id, 1274 * source topic id & destination topic id 1275 */ 1276 function bbp_move_reply_count( $move_reply_id, $source_topic_id, $destination_topic_id ) { 1277 1278 // Forum topic counts 1279 bbp_update_forum_topic_count( bbp_get_topic_forum_id( $destination_topic_id ) ); 1280 1281 // Forum reply counts 1282 bbp_update_forum_reply_count( bbp_get_topic_forum_id( $destination_topic_id ) ); 1283 1284 // Topic reply counts 1285 bbp_update_topic_reply_count( $source_topic_id ); 1286 bbp_update_topic_reply_count( $destination_topic_id ); 1287 1288 // Topic hidden reply counts 1289 bbp_update_topic_reply_count_hidden( $source_topic_id ); 1290 bbp_update_topic_reply_count_hidden( $destination_topic_id ); 1291 1292 // Topic voice counts 1293 bbp_update_topic_voice_count( $source_topic_id ); 1294 bbp_update_topic_voice_count( $destination_topic_id ); 1295 1296 do_action( 'bbp_move_reply_count', $move_reply_id, $source_topic_id, $destination_topic_id ); 1297 } 1298 1013 1299 /** Reply Actions *************************************************************/ 1014 1300 1015 1301 /** -
includes/common/template-tags.php
479 479 } 480 480 481 481 /** 482 * Check if current page is a reply move page 483 * 484 * @uses bbp_is_reply_move() To check if it's a reply move page 485 * @return bool True if it's the reply move page, false if not 486 */ 487 function bbp_is_reply_move() { 488 489 // Assume false 490 $retval = false; 491 492 // Check reply edit and GET params 493 if ( bbp_is_reply_edit() && !empty( $_GET['action'] ) && ( 'move' == $_GET['action'] ) ) 494 $retval = true; 495 496 return (bool) apply_filters( 'bbp_is_reply_move', $retval ); 497 } 498 499 /** 482 500 * Viewing a single reply 483 501 * 484 502 * @since bbPress (r3344) … … 800 818 * @uses bbp_is_topic_split() 801 819 * @uses bbp_is_single_reply() 802 820 * @uses bbp_is_reply_edit() 803 * @uses bbp_is_reply_ edit()821 * @uses bbp_is_reply_move() 804 822 * @uses bbp_is_single_view() 805 823 * @uses bbp_is_single_user_edit() 806 824 * @uses bbp_is_single_user() … … 865 883 866 884 if ( bbp_is_reply_edit() ) 867 885 $bbp_classes[] = bbp_get_reply_post_type() . '-edit'; 886 887 if ( bbp_is_reply_move() ) 888 $bbp_classes[] = bbp_get_reply_post_type() . '-move'; 868 889 869 890 if ( bbp_is_single_view() ) 870 891 $bbp_classes[] = 'bbp-view'; … … 937 958 * @uses bbp_is_topic_split() 938 959 * @uses bbp_is_single_reply() 939 960 * @uses bbp_is_reply_edit() 940 * @uses bbp_is_reply_ edit()961 * @uses bbp_is_reply_move() 941 962 * @uses bbp_is_single_view() 942 963 * @uses bbp_is_single_user_edit() 943 964 * @uses bbp_is_single_user() … … 991 1012 elseif ( bbp_is_reply_edit() ) 992 1013 $retval = true; 993 1014 1015 elseif ( bbp_is_reply_move() ) 1016 $retval = true; 1017 994 1018 elseif ( bbp_is_single_view() ) 995 1019 $retval = true; 996 1020 … … 1550 1574 * 1551 1575 * @since bbPress (r2756) 1552 1576 * 1553 * @uses wp_nonce_field() To gener ete a hidden nonce field1577 * @uses wp_nonce_field() To generate a hidden nonce field 1554 1578 */ 1555 1579 function bbp_split_topic_form_fields() { 1556 1580 ?> … … 1562 1586 } 1563 1587 1564 1588 /** 1589 * Move reply form fields 1590 * 1591 * Output the required hidden fields when moving a reply 1592 * 1593 * @uses wp_nonce_field() To generate a hidden nonce field 1594 */ 1595 function bbp_move_reply_form_fields() { 1596 ?> 1597 1598 <input type="hidden" name="action" id="bbp_post_action" value="bbp-move-reply" /> 1599 <input type="hidden" name="bbp_reply_id" id="bbp_reply_id" value="<?php echo absint( $_GET['reply_id'] ); ?>" /> 1600 1601 <?php wp_nonce_field( 'bbp-move-reply_' . bbp_get_reply_id() ); 1602 } 1603 1604 /** 1565 1605 * Output a textarea or TinyMCE if enabled 1566 1606 * 1567 1607 * @since bbPress (r3586) -
includes/core/template-loader.php
38 38 * @uses bbp_get_topic_split_template() To get topic split template 39 39 * @uses bbp_is_topic_edit() To check if page is topic edit 40 40 * @uses bbp_get_topic_edit_template() To get topic edit template 41 * @uses bbp_is_reply_move() To check if page is reply move 42 * @uses bbp_get_reply_move_template() To get reply move template 41 43 * @uses bbp_is_reply_edit() To check if page is reply edit 42 44 * @uses bbp_get_reply_edit_template() To get reply edit template 43 45 * @uses bbp_set_theme_compat_template() To set the global theme compat template … … 85 87 // Topic Archive 86 88 elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template() ) ) : 87 89 90 // Reply move 91 elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template() ) ) : 92 88 93 // Editing a reply 89 94 elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) : 90 95 … … 406 411 } 407 412 408 413 /** 414 * Get the reply move template 415 * 416 * @uses bbp_get_reply_post_type() 417 * @uses bbp_get_query_template() 418 * @return string Path to template file 419 */ 420 function bbp_get_reply_move_template() { 421 $templates = array( 422 'single-' . bbp_get_reply_post_type() . '-move.php', // Reply move 423 ); 424 return bbp_get_query_template( 'reply_move', $templates ); 425 } 426 427 /** 409 428 * Get the topic template 410 429 * 411 430 * @since bbPress (r3311) -
includes/core/actions.php
203 203 add_action( 'bbp_merged_topic', 'bbp_merge_topic_count', 1, 3 ); 204 204 add_action( 'bbp_post_split_topic', 'bbp_split_topic_count', 1, 3 ); 205 205 206 // Move Reply 207 add_action( 'bbp_post_move_reply', 'bbp_move_reply_count', 1, 3 ); 208 206 209 // Before Delete/Trash/Untrash Topic 207 210 add_action( 'wp_trash_post', 'bbp_trash_topic' ); 208 211 add_action( 'trash_post', 'bbp_trash_topic' ); … … 281 284 add_action( 'bbp_template_redirect', 'bbp_merge_topic_handler', 1 ); 282 285 add_action( 'bbp_template_redirect', 'bbp_split_topic_handler', 1 ); 283 286 add_action( 'bbp_template_redirect', 'bbp_toggle_topic_handler', 1 ); 287 add_action( 'bbp_template_redirect', 'bbp_move_reply_handler', 1 ); 284 288 add_action( 'bbp_template_redirect', 'bbp_toggle_reply_handler', 1 ); 285 289 add_action( 'bbp_template_redirect', 'bbp_favorites_handler', 1 ); 286 290 add_action( 'bbp_template_redirect', 'bbp_subscriptions_handler', 1 ); -
includes/core/theme-compat.php
443 443 * @uses bbp_get_topic_split_template() To get topic split template 444 444 * @uses bbp_is_topic_edit() To check if page is topic edit 445 445 * @uses bbp_get_topic_edit_template() To get topic edit template 446 * @uses bbp_is_reply_move() To check if page is reply move 447 * @uses bbp_get_reply_move_template() To get reply move template 446 448 * @uses bbp_is_reply_edit() To check if page is reply edit 447 449 * @uses bbp_get_reply_edit_template() To get reply edit template 448 450 * @uses bbp_set_theme_compat_template() To set the global theme compat template … … 793 795 794 796 // Reply Edit 795 797 } elseif ( bbp_is_reply_edit() ) { 796 $new_content = $bbp->shortcodes->display_reply_form(); 798 799 // Move 800 if ( bbp_is_reply_move() ) { 801 ob_start(); 797 802 803 bbp_get_template_part( 'form', 'reply-move' ); 804 805 $new_content = ob_get_contents(); 806 807 ob_end_clean(); 808 809 // Edit 810 } else { 811 $new_content = $bbp->shortcodes->display_reply_form(); 812 } 813 798 814 // Single Reply 799 815 } elseif ( bbp_is_single_reply() ) { 800 816 $new_content = $bbp->shortcodes->display_reply( array( 'id' => get_the_ID() ) ); -
includes/core/filters.php
182 182 add_filter( 'bbp_get_topicmerge_template', 'bbp_add_template_locations' ); 183 183 add_filter( 'bbp_get_topictag_template', 'bbp_add_template_locations' ); 184 184 add_filter( 'bbp_get_topictagedit_template', 'bbp_add_template_locations' ); 185 add_filter( 'bbp_get_replymove_template', 'bbp_add_template_locations' ); 185 186 186 187 /** 187 188 * Add filters to anonymous post author data -
templates/default/bbpress/form-reply-move.php
1 <?php 2 3 /** 4 * Move Reply 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div id="bbpress-forums"> 13 14 <?php bbp_breadcrumb(); ?> 15 16 <?php if ( is_user_logged_in() && current_user_can( 'edit_topic', bbp_get_topic_id() ) ) : ?> 17 18 <div id="move-reply-<?php bbp_topic_id(); ?>" class="bbp-reply-move"> 19 20 <form id="move_reply" name="move_reply" method="post" action="<?php the_permalink(); ?>"> 21 22 <fieldset class="bbp-form"> 23 24 <legend><?php printf( __( 'Move reply "%s"', 'bbpress' ), bbp_get_reply_title() ); ?></legend> 25 26 <div> 27 28 <div class="bbp-template-notice info"> 29 <p><?php _e( 'When you move a reply, you can choose to use that reply as a new topic with a new title, or merge it into an existing topic.', 'bbpress' ); ?></p> 30 </div> 31 32 <div class="bbp-template-notice"> 33 <p><?php _e( 'If you use the existing topic option, replies within both topics will be merged chronologically. The order of the merged reply is based on the time and date it was posted.', 'bbpress' ); ?></p> 34 </div> 35 36 <fieldset class="bbp-form"> 37 <legend><?php _e( 'Move Method', 'bbpress' ); ?></legend> 38 39 <div> 40 <input name="bbp_reply_move_option" id="bbp_reply_move_option_reply" type="radio" checked="checked" value="topic" tabindex="<?php bbp_tab_index(); ?>" /> 41 <label for="bbp_reply_move_option_reply"><?php printf( __( 'New topic in <strong>%s</strong> titled:', 'bbpress' ), bbp_get_forum_title( bbp_get_reply_forum_id( bbp_get_reply_id() ) ) ); ?></label> 42 <input type="text" id="bbp_reply_move_destination_title" value="<?php printf( __( 'Moved: %s', 'bbpress' ), bbp_get_reply_title() ); ?>" tabindex="<?php bbp_tab_index(); ?>" size="35" name="bbp_reply_move_destination_title" /> 43 </div> 44 45 <?php if ( bbp_has_topics( array( 'show_stickies' => false, 'post_parent' => bbp_get_reply_forum_id( bbp_get_reply_id() ), 'post__not_in' => array( bbp_get_reply_topic_id( bbp_get_reply_id() ) ) ) ) ) : ?> 46 47 <div> 48 <input name="bbp_reply_move_option" id="bbp_reply_move_option_existing" type="radio" value="existing" tabindex="<?php bbp_tab_index(); ?>" /> 49 <label for="bbp_reply_move_option_existing"><?php _e( 'Use an existing topic in this forum:', 'bbpress' ); ?></label> 50 51 <?php 52 bbp_dropdown( array( 53 'post_type' => bbp_get_topic_post_type(), 54 'post_parent' => bbp_get_reply_forum_id( bbp_get_reply_id() ), 55 'selected' => -1, 56 'exclude' => bbp_get_reply_topic_id( bbp_get_reply_id() ), 57 'select_id' => 'bbp_destination_topic', 58 'none_found' => __( 'No other topics found!', 'bbpress' ) 59 ) ); 60 ?> 61 62 </div> 63 64 <?php endif; ?> 65 66 </fieldset> 67 68 <div class="bbp-template-notice error"> 69 <p><?php _e( '<strong>WARNING:</strong> This process cannot be undone.', 'bbpress' ); ?></p> 70 </div> 71 72 <div class="bbp-submit-wrapper"> 73 <button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_move_reply_submit" name="bbp_move_reply_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></button> 74 </div> 75 </div> 76 77 <?php bbp_move_reply_form_fields(); ?> 78 79 </fieldset> 80 </form> 81 </div> 82 83 <?php else : ?> 84 85 <div id="no-reply-<?php bbp_reply_id(); ?>" class="bbp-no-reply"> 86 <div class="entry-content"><?php is_user_logged_in() ? _e( 'You do not have the permissions to edit this reply!', 'bbpress' ) : _e( 'You cannot edit this reply.', 'bbpress' ); ?></div> 87 </div> 88 89 <?php endif; ?> 90 91 </div> -
templates/default/extras/single-reply-move.php
1 <?php 2 3 /** 4 * Move reply page 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 get_header(); ?> 11 12 <?php do_action( 'bbp_before_main_content' ); ?> 13 14 <?php do_action( 'bbp_template_notices' ); ?> 15 16 <?php while ( have_posts() ) : the_post(); ?> 17 18 <div id="bbp-edit-page" class="bbp-edit-page"> 19 <h1 class="entry-title"><?php the_title(); ?></h1> 20 <div class="entry-content"> 21 22 <?php bbp_get_template_part( 'form', 'reply-move' ); ?> 23 24 </div> 25 </div><!-- #bbp-edit-page --> 26 27 <?php endwhile; ?> 28 29 <?php do_action( 'bbp_after_main_content' ); ?> 30 31 <?php get_sidebar(); ?> 32 <?php get_footer(); ?>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)