The expression will always be true. Take a look at get_the_ID()
;
function get_the_ID() {
global $post;
return $post->ID;
}
So your code is effectively running as;
if ( $post->ID == $post->ID ) // always true!
Instead, cache the ID of the main post in a variable, then compare that instead.
<?php
global $post;
/**
* @var int Current post ID.
*/
$the_post_ID = $post->ID;
/**
* @var array All posts for bbp_forum.
*/
$cat_posts = get_posts('post_type=bbp_forum');
?>
<?php foreach ( $cat_posts as $post ) : ?>
<li<?php if ( $post->ID == $the_post_ID ) echo ' class="current"'; ?>>
<a href="https://wordpress.stackexchange.com/questions/12025/<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>