Changeset 3799
- Timestamp:
- 03/09/2012 11:03:12 PM (13 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-extend-buddypress.php
r3789 r3799 966 966 add_action( 'bp_actions', 'bbp_edit_topic_handler' ); 967 967 add_action( 'bp_actions', 'bbp_edit_reply_handler' ); 968 969 // Tweak the redirect field 970 add_filter( 'bbp_new_topic_redirect_to', array( $this, 'new_topic_redirect_to' ), 10, 3 ); 971 add_filter( 'bbp_new_reply_redirect_to', array( $this, 'new_reply_redirect_to' ), 10, 2 ); 968 972 } 969 973 … … 987 991 // Hide breadcrumb 988 992 add_filter( 'bbp_no_breadcrumb', '__return_true' ); 989 990 // Tweak the redirect field991 add_filter( 'bbp_new_topic_redirect_to', array( $this, 'new_topic_redirect_to' ), 10, 2 );992 add_filter( 'bbp_new_reply_redirect_to', array( $this, 'new_reply_redirect_to' ), 10, 2 );993 993 994 994 $this->display_forums( 0 ); … … 1193 1193 return false; 1194 1194 1195 $checked = bp_get_new_group_enable_forum() || groups_get_groupmeta( bp_get_new_group_id(), 'forum_id' ); 1196 ?> 1195 $checked = bp_get_new_group_enable_forum() || groups_get_groupmeta( bp_get_new_group_id(), 'forum_id' ); ?> 1197 1196 1198 1197 <h4><?php _e( 'Group Forums', 'buddypress' ); ?></h4> … … 1254 1253 ) ); 1255 1254 1256 // Create the initial topic1257 $topic_id = bbp_insert_topic(1258 array(1259 'post_parent' => $forum_id,1260 'post_title' => __( 'Hello World!', 'bbpress' ),1261 'post_content' => __( 'I am the first topic in your group forum. You can keep me, edit me, trash me, or delete me.', 'bbpress' )1262 ),1263 array( 'forum_id' => $forum_id )1264 );1265 1266 // Create the initial reply1267 $reply_id = bbp_insert_reply(1268 array(1269 'post_parent' => $topic_id,1270 'post_title' => __( 'Re: Hello World!', 'bbpress' ),1271 'post_content' => __( 'Oh, and this is what a reply looks like.', 'bbpress' )1272 ),1273 array(1274 'forum_id' => $forum_id,1275 'topic_id' => $topic_id1276 )1277 );1278 1279 1255 // Add the ID's to group meta 1280 groups_update_groupmeta( bp_get_new_group_id(), 'forum_id', $forum_id ); 1281 groups_update_groupmeta( bp_get_new_group_id(), 'first_topic_id', $topic_id ); 1282 groups_update_groupmeta( bp_get_new_group_id(), 'first_reply_id', $reply_id ); 1256 groups_update_groupmeta( bp_get_new_group_id(), 'forum_id', $forum_id ); 1283 1257 1284 1258 break; … … 1287 1261 // Forum was created but is now being undone 1288 1262 if ( !empty( $forum_id ) ) { 1289 $topic_id = groups_get_groupmeta( bp_get_new_group_id(), 'first_topic_id' );1290 $reply_id = groups_get_groupmeta( bp_get_new_group_id(), 'first_reply_id' );1291 1292 // Delete initial content1293 1263 wp_delete_post( $forum_id, true ); 1294 wp_delete_post( $topic_id, true ); 1295 wp_delete_post( $reply_id, true ); 1296 1297 // Remove the forum ID to group meta 1298 groups_delete_groupmeta( bp_get_new_group_id(), 'forum_id' ); 1299 groups_delete_groupmeta( bp_get_new_group_id(), 'first_topic_id' ); 1300 groups_delete_groupmeta( bp_get_new_group_id(), 'first_reply_id' ); 1264 groups_delete_groupmeta( bp_get_new_group_id(), 'forum_id' ); 1301 1265 } 1302 1266 … … 1572 1536 * 1573 1537 * @since bbPress (r3653) 1538 * @param str $redirect_url 1539 * @param str $redirect_to 1540 */ 1541 public function new_topic_redirect_to( $redirect_url = '', $redirect_to = '', $topic_id = 0 ) { 1542 if ( bp_is_group() ) { 1543 $topic = bbp_get_topic( $topic_id ); 1544 $topic_hash = '#post-' . $topic_id; 1545 $redirect_url = trailingslashit( bp_get_group_permalink( groups_get_current_group() ) ) . trailingslashit( $this->slug ) . trailingslashit( $this->topic_slug ) . trailingslashit( $topic->post_name ) . $topic_hash; 1546 } 1547 1548 return $redirect_url; 1549 } 1550 1551 /** 1552 * Redirect to the group forum screen 1553 * 1554 * @since bbPress (r3653) 1555 */ 1556 public function new_reply_redirect_to( $redirect_url = '', $redirect_to = '', $reply_id = 0 ) { 1557 global $wp_rewrite; 1558 1559 if ( bp_is_group() ) { 1560 $topic_id = bbp_get_reply_topic_id( $reply_id ); 1561 $topic = bbp_get_topic( $topic_id ); 1562 $reply_position = bbp_get_reply_position( $reply_id, $topic_id ); 1563 $reply_page = ceil( (int) $reply_position / (int) bbp_get_replies_per_page() ); 1564 $reply_hash = '#post-' . $reply_id; 1565 $topic_url = trailingslashit( bp_get_group_permalink( groups_get_current_group() ) ) . trailingslashit( $this->slug ) . trailingslashit( $this->topic_slug ) . trailingslashit( $topic->post_name ); 1566 1567 // Don't include pagination if on first page 1568 if ( 1 >= $reply_page ) { 1569 $redirect_url = trailingslashit( $topic_url ) . $reply_hash; 1570 1571 // Include pagination 1572 } else { 1573 $redirect_url = trailingslashit( $topic_url ) . trailingslashit( $wp_rewrite->pagination_base ) . trailingslashit( $reply_page ) . $reply_hash; 1574 } 1575 1576 // Add topic view query arg back to end if it is set 1577 if ( bbp_get_view_all() ) { 1578 $redirect_url = bbp_add_view_all( $redirect_url ); 1579 } 1580 } 1581 1582 return $redirect_url; 1583 } 1584 1585 /** 1586 * Redirect to the group admin forum edit screen 1587 * 1588 * @since bbPress (r3653) 1574 1589 * 1575 1590 * @uses groups_get_current_group() … … 1579 1594 * @uses bp_get_groups_root_slug() 1580 1595 */ 1581 public function new_topic_redirect_to( $redirect_url = '', $redirect_to = '' ) {1582 return $redirect_url;1583 }1584 1585 /**1586 * Redirect to the group admin forum edit screen1587 *1588 * @since bbPress (r3653)1589 *1590 * @uses groups_get_current_group()1591 * @uses bp_is_group_admin_screen()1592 * @uses trailingslashit()1593 * @uses bp_get_root_domain()1594 * @uses bp_get_groups_root_slug()1595 */1596 1596 public function edit_redirect_to( $redirect_url = '' ) { 1597 1597 -
branches/plugin/bbp-includes/bbp-forum-functions.php
r3790 r3799 1628 1628 function bbp_forum_query_subforum_ids( $forum_id ) { 1629 1629 $subforum_ids = bbp_get_public_child_ids( $forum_id, bbp_get_forum_post_type() ); 1630 usort( $subforum_ids, '_bbp_forum_query_usort_subforum_ids' );1630 //usort( $subforum_ids, '_bbp_forum_query_usort_subforum_ids' ); 1631 1631 1632 1632 return apply_filters( 'bbp_get_forum_subforum_ids', $subforum_ids, $forum_id ); -
branches/plugin/bbp-includes/bbp-reply-functions.php
r3767 r3799 314 314 315 315 // Allow to be filtered 316 $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $redirect_to );316 $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $redirect_to, $reply_id ); 317 317 318 318 /** Successful Save ***********************************************/ -
branches/plugin/bbp-includes/bbp-topic-functions.php
r3767 r3799 365 365 366 366 // Allow to be filtered 367 $redirect_url = apply_filters( 'bbp_new_topic_redirect_to', $redirect_url, $redirect_to );367 $redirect_url = apply_filters( 'bbp_new_topic_redirect_to', $redirect_url, $redirect_to, $topic_id ); 368 368 369 369 /** Successful Save ***********************************************/
Note: See TracChangeset
for help on using the changeset viewer.