Skip to:
Content

bbPress.org

Changeset 4522


Ignore:
Timestamp:
11/25/2012 09:33:09 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Replies:

  • Add ability to move a reply into a new topic, or into an existing topic.
  • Includes new template part, new extra page template, and functions for handling the data move and template output.
  • Props jmdodd.
  • Fixes #1900.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/template-tags.php

    r4518 r4522  
    477477
    478478    return (bool) apply_filters( 'bbp_is_reply_edit', $retval );
     479}
     480
     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 */
     487function 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 );
    479497}
    480498
     
    801819 * @uses bbp_is_single_reply()
    802820 * @uses bbp_is_reply_edit()
    803  * @uses bbp_is_reply_edit()
     821 * @uses bbp_is_reply_move()
    804822 * @uses bbp_is_single_view()
    805823 * @uses bbp_is_single_user_edit()
     
    866884    if ( bbp_is_reply_edit() )
    867885        $bbp_classes[] = bbp_get_reply_post_type() . '-edit';
     886       
     887    if ( bbp_is_reply_move() )
     888        $bbp_classes[] = bbp_get_reply_post_type() . '-move';
    868889
    869890    if ( bbp_is_single_view() )
     
    938959 * @uses bbp_is_single_reply()
    939960 * @uses bbp_is_reply_edit()
    940  * @uses bbp_is_reply_edit()
     961 * @uses bbp_is_reply_move()
    941962 * @uses bbp_is_single_view()
    942963 * @uses bbp_is_single_user_edit()
     
    9901011
    9911012    elseif ( bbp_is_reply_edit() )
     1013        $retval = true;
     1014
     1015    elseif ( bbp_is_reply_move() )
    9921016        $retval = true;
    9931017
     
    15511575 * @since bbPress (r2756)
    15521576 *
    1553  * @uses wp_nonce_field() To generete a hidden nonce field
     1577 * @uses wp_nonce_field() To generate a hidden nonce field
    15541578 */
    15551579function bbp_split_topic_form_fields() {
     
    15601584
    15611585    <?php wp_nonce_field( 'bbp-split-topic_' . bbp_get_topic_id() );
     1586}
     1587
     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 */
     1595function 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() );
    15621602}
    15631603
  • trunk/includes/core/actions.php

    r4510 r4522  
    204204add_action( 'bbp_post_split_topic', 'bbp_split_topic_count', 1, 3 );
    205205
     206// Move Reply
     207add_action( 'bbp_post_move_reply', 'bbp_move_reply_count', 1, 3 );
     208
    206209// Before Delete/Trash/Untrash Topic
    207210add_action( 'wp_trash_post', 'bbp_trash_topic'   );
     
    282285add_action( 'bbp_template_redirect', 'bbp_split_topic_handler',     1  );
    283286add_action( 'bbp_template_redirect', 'bbp_toggle_topic_handler',    1  );
     287add_action( 'bbp_template_redirect', 'bbp_move_reply_handler',      1  );
    284288add_action( 'bbp_template_redirect', 'bbp_toggle_reply_handler',    1  );
    285289add_action( 'bbp_template_redirect', 'bbp_favorites_handler',       1  );
  • trunk/includes/core/filters.php

    r4323 r4522  
    183183add_filter( 'bbp_get_topictag_template',     'bbp_add_template_locations' );
    184184add_filter( 'bbp_get_topictagedit_template', 'bbp_add_template_locations' );
     185add_filter( 'bbp_get_replymove_template',    'bbp_add_template_locations' );
    185186
    186187/**
  • trunk/includes/core/template-loader.php

    r4328 r4522  
    3939 * @uses bbp_is_topic_edit() To check if page is topic edit
    4040 * @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
    4143 * @uses bbp_is_reply_edit() To check if page is reply edit
    4244 * @uses bbp_get_reply_edit_template() To get reply edit template
     
    8587    // Topic Archive
    8688    elseif ( bbp_is_topic_archive()    && ( $new_template = bbp_get_topic_archive_template()    ) ) :
     89
     90    // Reply move
     91    elseif ( bbp_is_reply_move()       && ( $new_template = bbp_get_reply_move_template()       ) ) :
    8792
    8893    // Editing a reply
     
    404409    );
    405410    return bbp_get_query_template( 'reply_edit', $templates );
     411}
     412
     413/**
     414 * Get the reply move template
     415 *
     416 * @since bbPress (r4521)
     417 *
     418 * @uses bbp_get_reply_post_type()
     419 * @uses bbp_get_query_template()
     420 * @return string Path to template file
     421 */
     422function bbp_get_reply_move_template() {
     423    $templates = array(
     424        'single-' . bbp_get_reply_post_type() . '-move.php', // Reply move
     425    );
     426    return bbp_get_query_template( 'reply_move', $templates );
    406427}
    407428
  • trunk/includes/core/theme-compat.php

    r4411 r4522  
    444444 * @uses bbp_is_topic_edit() To check if page is topic edit
    445445 * @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
    446448 * @uses bbp_is_reply_edit() To check if page is reply edit
    447449 * @uses bbp_get_reply_edit_template() To get reply edit template
     
    794796    // Reply Edit
    795797    } 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();
     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        }
    797813
    798814    // Single Reply
  • trunk/includes/replies/functions.php

    r4516 r4522  
    10111011}
    10121012
     1013/**
     1014 * Move reply handler
     1015 *
     1016 * Handles the front end move reply submission
     1017 *
     1018 * @since bbPress (r4521)
     1019 *
     1020 * @uses bbPress:errors::add() To log various error messages
     1021 * @uses bbp_get_reply() To get the reply
     1022 * @uses bbp_get_topic() To get the topics
     1023 * @uses bbp_verify_nonce_request() To verify the nonce and check the request
     1024 * @uses current_user_can() To check if the current user can edit the reply and topics
     1025 * @uses bbp_get_topic_post_type() To get the topic post type
     1026 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error}
     1027 * @uses do_action() Calls 'bbp_pre_move_reply' with the from reply id, source
     1028 *                    and destination topic ids
     1029 * @uses bbp_get_reply_post_type() To get the reply post type
     1030 * @uses wpdb::prepare() To prepare our sql query
     1031 * @uses wpdb::get_results() To execute the sql query and get results
     1032 * @uses wp_update_post() To update the replies
     1033 * @uses bbp_update_reply_topic_id() To update the reply topic id
     1034 * @uses bbp_get_topic_forum_id() To get the topic forum id
     1035 * @uses bbp_update_reply_forum_id() To update the reply forum id
     1036 * @uses do_action() Calls 'bbp_split_topic_reply' with the reply id and
     1037 *                    destination topic id
     1038 * @uses bbp_update_topic_last_reply_id() To update the topic last reply id
     1039 * @uses bbp_update_topic_last_active_time() To update the topic last active meta
     1040 * @uses do_action() Calls 'bbp_post_split_topic' with the destination and
     1041 *                    source topic ids and source topic's forum id
     1042 * @uses bbp_get_topic_permalink() To get the topic permalink
     1043 * @uses wp_safe_redirect() To redirect to the topic link
     1044 */
     1045function bbp_move_reply_handler() {
     1046
     1047    // Bail if not a POST action
     1048    if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
     1049        return;
     1050
     1051    // Bail if action is not 'bbp-move-reply'
     1052    if ( empty( $_POST['action'] ) || ( 'bbp-move-reply' !== $_POST['action'] ) )
     1053        return;
     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
     1060    /** Move Reply ***********************************************************/
     1061
     1062    if ( empty( $_POST['bbp_reply_id'] ) ) {
     1063        bbp_add_error( 'bbp_move_reply_reply_id', __( '<strong>ERROR</strong>: Reply ID to move not found!', 'bbpress' ) );
     1064    } else {
     1065        $move_reply_id = (int) $_POST['bbp_reply_id'];
     1066    }
     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
     1084    // Nonce check failed
     1085    if ( ! bbp_verify_nonce_request( 'bbp-move-reply_' . $move_reply->ID ) ) {
     1086        bbp_add_error( 'bbp_move_reply_nonce', __( '<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress' ) );
     1087        return;
     1088    }
     1089
     1090    // Use cannot edit topic
     1091    if ( !current_user_can( 'edit_topic', $source_topic->ID ) ) {
     1092        bbp_add_error( 'bbp_move_reply_source_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the source topic.', 'bbpress' ) );
     1093    }
     1094
     1095    // How to move
     1096    if ( !empty( $_POST['bbp_reply_move_option'] ) ) {
     1097        $move_option = (string) trim( $_POST['bbp_reply_move_option'] );
     1098    }
     1099
     1100    // Invalid move option
     1101    if ( empty( $move_option ) || !in_array( $move_option, array( 'existing', 'topic' ) ) ) {
     1102        bbp_add_error( 'bbp_move_reply_option', __( '<strong>ERROR</strong>: You need to choose a valid move option.', 'bbpress' ) );
     1103
     1104    // Valid move option
     1105    } else {
     1106
     1107        // What kind of move
     1108        switch ( $move_option ) {
     1109
     1110            // Into an existing topic
     1111            case 'existing' :
     1112
     1113                // Get destination topic id
     1114                if ( empty( $_POST['bbp_destination_topic'] ) ) {
     1115                    bbp_add_error( 'bbp_move_reply_destination_id', __( '<strong>ERROR</strong>: Destination topic ID not found!', 'bbpress' ) );
     1116                } else {
     1117                    $destination_topic_id = (int) $_POST['bbp_destination_topic'];
     1118                }
     1119
     1120                // Get the destination topic
     1121                $destination_topic = bbp_get_topic( $destination_topic_id );
     1122
     1123                // No destination topic
     1124                if ( empty( $destination_topic ) ) {
     1125                    bbp_add_error( 'bbp_move_reply_destination_not_found', __( '<strong>ERROR</strong>: The topic you want to move to was not found!', 'bbpress' ) );
     1126                }
     1127
     1128                // User cannot edit the destination topic
     1129                if ( !current_user_can( 'edit_topic', $destination_topic->ID ) ) {
     1130                    bbp_add_error( 'bbp_move_reply_destination_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the destination topic!', 'bbpress' ) );
     1131                }
     1132
     1133                // Reply position
     1134                $reply_position = bbp_get_topic_reply_count( $destination_topic->ID ) + 1;
     1135
     1136                // New reply data
     1137                $postarr = array(
     1138                    'ID'            => $move_reply->ID,
     1139                    'post_title'    => sprintf( __( 'Reply To: %s', 'bbpress' ), $destination_topic->post_title ),
     1140                    'post_name'     => false, // will be automatically generated
     1141                    'post_parent'   => $destination_topic->ID,
     1142                    'post_position' => $reply_position,
     1143                    'guid'          => ''
     1144                );
     1145
     1146                // Update the reply
     1147                wp_update_post( $postarr );
     1148
     1149                // Adjust reply meta values
     1150                bbp_update_reply_topic_id( $move_reply->ID, $destination_topic->ID );
     1151                bbp_update_reply_forum_id( $move_reply->ID, bbp_get_topic_forum_id( $destination_topic->ID ) );
     1152
     1153                break;
     1154
     1155            // Move reply to a new topic
     1156            case 'topic' :
     1157            default :
     1158
     1159                // User needs to be able to publish topics
     1160                if ( current_user_can( 'publish_topics' ) ) {
     1161
     1162                    // Use the new title that was passed
     1163                    if ( !empty( $_POST['bbp_reply_move_destination_title'] ) ) {
     1164                        $destination_topic_title = esc_attr( strip_tags( $_POST['bbp_reply_move_destination_title'] ) );
     1165
     1166                    // Use the source topic title
     1167                    } else {
     1168                        $destination_topic_title = $source_topic->post_title;
     1169                    }
     1170
     1171                    // Setup the updated topic parameters
     1172                    $postarr = array(
     1173                        'ID'          => $move_reply->ID,
     1174                        'post_title'  => $destination_topic_title,
     1175                        'post_name'   => false,
     1176                        'post_type'   => bbp_get_topic_post_type(),
     1177                        'post_parent' => $source_topic->post_parent,
     1178                        'guid'        => ''
     1179                    );
     1180
     1181                    // Update the topic
     1182                    $destination_topic_id = wp_update_post( $postarr );
     1183                    $destination_topic    = bbp_get_topic( $destination_topic_id );
     1184
     1185                    // Make sure the new topic knows its a topic
     1186                    bbp_update_topic_topic_id( $move_reply->ID );
     1187
     1188                    // Shouldn't happen
     1189                    if ( false == $destination_topic_id || is_wp_error( $destination_topic_id ) || empty( $destination_topic ) ) {
     1190                        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' ) );
     1191                    }
     1192
     1193                // User cannot publish posts
     1194                } else {
     1195                    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' ) );
     1196                }
     1197
     1198                break;
     1199        }
     1200    }
     1201
     1202    // Bail if there are errors
     1203    if ( bbp_has_errors() ) {
     1204        return;
     1205    }
     1206
     1207    /** No Errors - Clean Up **************************************************/
     1208
     1209    // Update counts, etc...
     1210    do_action( 'bbp_pre_move_reply', $move_reply->ID, $source_topic->ID, $destination_topic->ID );
     1211
     1212    /** Date Check ************************************************************/
     1213
     1214    // Check if the destination topic is older than the move reply
     1215    if ( strtotime( $move_reply->post_date ) < strtotime( $destination_topic->post_date ) ) {
     1216
     1217        // Set destination topic post_date to 1 second before from reply
     1218        $destination_post_date = date( 'Y-m-d H:i:s', strtotime( $move_reply->post_date ) - 1 );
     1219
     1220        $postarr = array(
     1221            'ID'            => $destination_topic_id,
     1222            'post_date'     => $destination_post_date,
     1223            'post_date_gmt' => get_gmt_from_date( $destination_post_date )
     1224        );
     1225   
     1226        // Update destination topic
     1227        wp_update_post( $postarr );
     1228    }
     1229   
     1230    // Set the last reply ID and freshness to the move_reply
     1231    $last_reply_id = $move_reply->ID;
     1232    $freshness     = $move_reply->post_date;
     1233   
     1234    // It is a new topic and we need to set some default metas to make
     1235    // the topic display in bbp_has_topics() list
     1236    if ( 'topic' == $move_option ) {
     1237        bbp_update_topic_last_reply_id   ( $destination_topic->ID, $last_reply_id );
     1238        bbp_update_topic_last_active_id  ( $destination_topic->ID, $last_reply_id );
     1239        bbp_update_topic_last_active_time( $destination_topic->ID, $freshness     );
     1240
     1241    // Otherwise update the existing destination topic
     1242    } else {
     1243        bbp_update_topic_last_reply_id   ( $destination_topic->ID );
     1244        bbp_update_topic_last_active_id  ( $destination_topic->ID );
     1245        bbp_update_topic_last_active_time( $destination_topic->ID );
     1246    }
     1247
     1248    // Update source topic ID last active
     1249    bbp_update_topic_last_reply_id   ( $source_topic->ID );
     1250    bbp_update_topic_last_active_id  ( $source_topic->ID );
     1251    bbp_update_topic_last_active_time( $source_topic->ID );
     1252   
     1253    /** Successful Move ******************************************************/
     1254
     1255    // Update counts, etc...
     1256    do_action( 'bbp_post_move_reply', $move_reply->ID, $source_topic->ID, $destination_topic->ID );
     1257
     1258    // Redirect back to the topic
     1259    wp_safe_redirect( bbp_get_topic_permalink( $destination_topic->ID ) );
     1260
     1261    // For good measure
     1262    exit();
     1263}
     1264
     1265/**
     1266 * Fix counts on reply move
     1267 *
     1268 * When a reply is moved, update the counts of source and destination topic
     1269 * and their forums.
     1270 *
     1271 * @since bbPress (r4521)
     1272 *
     1273 * @param int $move_reply_id Move reply id
     1274 * @param int $source_topic_id Source topic id
     1275 * @param int $destination_topic_id Destination topic id
     1276 * @uses bbp_update_forum_topic_count() To update the forum topic counts
     1277 * @uses bbp_update_forum_reply_count() To update the forum reply counts
     1278 * @uses bbp_update_topic_reply_count() To update the topic reply counts
     1279 * @uses bbp_update_topic_voice_count() To update the topic voice counts
     1280 * @uses bbp_update_topic_reply_count_hidden() To update the topic hidden reply
     1281 *                                              count
     1282 * @uses do_action() Calls 'bbp_move_reply_count' with the move reply id,
     1283 *                    source topic id & destination topic id
     1284 */
     1285function bbp_move_reply_count( $move_reply_id, $source_topic_id, $destination_topic_id ) {
     1286
     1287    // Forum topic counts
     1288    bbp_update_forum_topic_count( bbp_get_topic_forum_id( $destination_topic_id ) );
     1289
     1290    // Forum reply counts
     1291    bbp_update_forum_reply_count( bbp_get_topic_forum_id( $destination_topic_id ) );
     1292
     1293    // Topic reply counts
     1294    bbp_update_topic_reply_count( $source_topic_id      );
     1295    bbp_update_topic_reply_count( $destination_topic_id );
     1296
     1297    // Topic hidden reply counts
     1298    bbp_update_topic_reply_count_hidden( $source_topic_id      );
     1299    bbp_update_topic_reply_count_hidden( $destination_topic_id );
     1300
     1301    // Topic voice counts
     1302    bbp_update_topic_voice_count( $source_topic_id      );
     1303    bbp_update_topic_voice_count( $destination_topic_id );
     1304
     1305    do_action( 'bbp_move_reply_count', $move_reply_id, $source_topic_id, $destination_topic_id );
     1306}
     1307
    10131308/** Reply Actions *************************************************************/
    10141309
  • trunk/includes/replies/template-tags.php

    r4508 r4522  
    14111411     *  - sep: Separator. Defaults to ' | '
    14121412     *  - links: Array of the links to display. By default, edit, trash,
    1413      *            spam and topic split links are displayed
     1413     *            spam, reply move, and topic split links are displayed
    14141414     * @uses bbp_is_topic() To check if it's the topic page
    14151415     * @uses bbp_is_reply() To check if it's the reply page
     
    14181418     * @uses bbp_get_reply_trash_link() To get the reply trash link
    14191419     * @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
    14201421     * @uses bbp_get_topic_split_link() To get the topic split link
    14211422     * @uses current_user_can() To check if the current user can edit or
     
    14581459            $r['links'] = array (
    14591460                'edit'  => bbp_get_reply_edit_link ( $r ),
     1461                'move'  => bbp_get_reply_move_link ( $r ),
    14601462                'split' => bbp_get_topic_split_link( $r ),
    14611463                'trash' => bbp_get_reply_trash_link( $r ),
     
    17401742
    17411743/**
     1744 * Move reply link
     1745 *
     1746 * Output the move link of the reply
     1747 *
     1748 * @since bbPress (r4521)
     1749 *
     1750 * @param mixed $args See {@link bbp_get_reply_move_link()}
     1751 * @uses bbp_get_reply_move_link() To get the reply move link
     1752 */
     1753function bbp_reply_move_link( $args = '' ) {
     1754    echo bbp_get_reply_move_link( $args );
     1755}
     1756
     1757    /**
     1758     * Get move reply link
     1759     *
     1760     * Return the move link of the reply
     1761     *
     1762     * @since bbPress (r4521)
     1763     *
     1764     * @param mixed $args This function supports these arguments:
     1765     *  - id: Reply id
     1766     *  - link_before: HTML before the link
     1767     *  - link_after: HTML after the link
     1768     *  - move_text: Move text
     1769     *  - move_title: Move title attribute
     1770     * @uses bbp_get_reply_id() To get the reply id
     1771     * @uses bbp_get_reply() To get the reply
     1772     * @uses current_user_can() To check if the current user can edit the
     1773     *                           topic
     1774     * @uses bbp_get_reply_topic_id() To get the reply topic id
     1775     * @uses bbp_get_reply_edit_url() To get the reply edit url
     1776     * @uses add_query_arg() To add custom args to the url
     1777     * @uses wp_nonce_url() To nonce the url
     1778     * @uses esc_url() To escape the url
     1779     * @uses apply_filters() Calls 'bbp_get_reply_move_link' with the reply
     1780     *                        move link and args
     1781     * @return string Reply move link
     1782     */
     1783    function bbp_get_reply_move_link( $args = '' ) {
     1784
     1785        // Parse arguments against default values
     1786        $r = bbp_parse_args( $args, array(
     1787            'id'          => 0,
     1788            'link_before' => '',
     1789            'link_after'  => '',
     1790            'split_text'  => __( 'Move',            'bbpress' ),
     1791            'split_title' => __( 'Move this reply', 'bbpress' )
     1792        ), 'get_reply_move_link' );
     1793
     1794        $reply_id = bbp_get_reply_id( $r['id'] );
     1795        $topic_id = bbp_get_reply_topic_id( $reply_id );
     1796
     1797        if ( empty( $reply_id ) || !current_user_can( 'moderate', $topic_id ) )
     1798            return;
     1799
     1800        $uri = esc_url( add_query_arg( array(
     1801            'action'   => 'move',
     1802            'reply_id' => $reply_id
     1803        ), bbp_get_reply_edit_url( $reply_id ) ) );
     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/**
    17421811 * Split topic link
    17431812 *
    1744  * Output the split link of the topic (but is bundled with each topic)
     1813 * Output the split link of the topic (but is bundled with each reply)
    17451814 *
    17461815 * @since bbPress (r2756)
     
    17771846     * @uses apply_filters() Calls 'bbp_get_topic_split_link' with the topic
    17781847     *                        split link and args
    1779      * @return string Reply spam link
     1848     * @return string Topic split link
    17801849     */
    17811850    function bbp_get_topic_split_link( $args = '' ) {
  • trunk/includes/topics/functions.php

    r4516 r4522  
    16641664
    16651665    // 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 ) );
    16671667
    16681668    // 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 ) );
    16701670
    16711671    // Topic Reply Counts
  • trunk/includes/topics/template-tags.php

    r4515 r4522  
    133133    // Set post_parent back to 0 if originally set to 'any'
    134134    if ( 'any' == $r['post_parent'] )
    135         $r['post_parent'] = $post_parent = 0;
     135        $r['post_parent'] = 0;
    136136
    137137    // Limited the number of pages shown
     
    279279            // Default
    280280            } else {
    281                 $base = get_permalink( $post_parent );
     281                $base = get_permalink( (int) $r['post_parent'] );
    282282            }
    283283
Note: See TracChangeset for help on using the changeset viewer.