예제 #1
0
/**
 * Resets topic data.
 *
 * @since  1.0.0
 * @access public
 * @param  object|int  $post
 * @return array
 */
function mb_reset_topic_data($post, $reset_latest = false)
{
    $post = is_object($post) ? $post : get_post($post);
    $forum_id = mb_get_topic_forum_id($post->ID);
    $forum_last_topic = mb_get_forum_last_topic_id($forum_id);
    /* Reset forum topic count. */
    mb_reset_forum_topic_count($forum_id);
    /* Reset forum reply count. */
    mb_reset_forum_reply_count($forum_id);
    /* If this is the last topic, reset forum latest data. */
    if ($post->ID === absint($forum_last_topic) || true === $reset_latest) {
        mb_reset_forum_latest($forum_id);
    }
    /* Reset user topic count. */
    mb_set_user_topic_count($post->post_author);
}
예제 #2
0
/**
 * Returns the forum last topic link.  This returns the last topic by activity, which is not
 * necessarily the newest topic created.
 *
 * @since  1.0.0
 * @access public
 * @param  int     $forum_id
 * @return string
 */
function mb_get_forum_last_topic_link($forum_id = 0)
{
    $forum_id = mb_get_forum_id($forum_id);
    $topic_id = mb_get_forum_last_topic_id($forum_id);
    $topic_link = $topic_id ? mb_get_topic_link($topic_id) : '';
    return apply_filters('mb_get_forum_last_topic_link', $topic_link, $forum_id);
}