Changeset 4488
- Timestamp:
- 11/23/2012 11:24:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/forums/functions.php
r4258 r4488 1473 1473 */ 1474 1474 function bbp_update_forum( $args = '' ) { 1475 $defaults = array( 1475 1476 // Parse arguments with default values 1477 $r = bbp_parse_args( $args, array( 1476 1478 'forum_id' => 0, 1477 1479 'post_parent' => 0, … … 1481 1483 'last_active_time' => 0, 1482 1484 'last_active_status' => bbp_get_public_status_id() 1483 ); 1484 $r = bbp_parse_args( $args, $defaults, 'update_forum' ); 1485 extract( $r ); 1485 ), 'update_forum' ); 1486 1486 1487 1487 // Last topic and reply ID's 1488 bbp_update_forum_last_topic_id( $ forum_id, $last_topic_id);1489 bbp_update_forum_last_reply_id( $ forum_id, $last_reply_id);1488 bbp_update_forum_last_topic_id( $r['forum_id'], $r['last_topic_id'] ); 1489 bbp_update_forum_last_reply_id( $r['forum_id'], $r['last_reply_id'] ); 1490 1490 1491 1491 // Active dance 1492 $ last_active_id = bbp_update_forum_last_active_id( $forum_id, $last_active_id);1492 $r['last_active_id'] = bbp_update_forum_last_active_id( $r['forum_id'], $r['last_active_id'] ); 1493 1493 1494 1494 // If no active time was passed, get it from the last_active_id 1495 if ( empty( $last_active_time ) ) 1496 $last_active_time = get_post_field( 'post_date', $last_active_id ); 1497 1498 if ( bbp_get_public_status_id() == $last_active_status ) { 1499 bbp_update_forum_last_active_time( $forum_id, $last_active_time ); 1495 if ( empty( $r['last_active_time'] ) ) { 1496 $r['last_active_time'] = get_post_field( 'post_date', $r['last_active_id'] ); 1497 } 1498 1499 if ( bbp_get_public_status_id() == $r['last_active_status'] ) { 1500 bbp_update_forum_last_active_time( $r['forum_id'], $r['last_active_time'] ); 1500 1501 } 1501 1502 1502 1503 // Counts 1503 bbp_update_forum_subforum_count ( $ forum_id);1504 bbp_update_forum_reply_count ( $ forum_id);1505 bbp_update_forum_topic_count ( $ forum_id);1506 bbp_update_forum_topic_count_hidden( $ forum_id);1504 bbp_update_forum_subforum_count ( $r['forum_id'] ); 1505 bbp_update_forum_reply_count ( $r['forum_id'] ); 1506 bbp_update_forum_topic_count ( $r['forum_id'] ); 1507 bbp_update_forum_topic_count_hidden( $r['forum_id'] ); 1507 1508 1508 1509 // Update the parent forum if one was passed 1509 if ( !empty( $ post_parent ) && is_numeric( $post_parent) ) {1510 if ( !empty( $r['post_parent'] ) && is_numeric( $r['post_parent'] ) ) { 1510 1511 bbp_update_forum( array( 1511 'forum_id' => $ post_parent,1512 'post_parent' => get_post_field( 'post_parent', $ post_parent)1512 'forum_id' => $r['post_parent'], 1513 'post_parent' => get_post_field( 'post_parent', $r['post_parent'] ) 1513 1514 ) ); 1514 1515 }
Note: See TracChangeset
for help on using the changeset viewer.