I did it my myself:
add these two functions to class.ipbcomments.php:
function get_replies_number( $topic_id ) {
if ( ! (isset($this->options['ipb_field_path']) OR file_exists($this->options['ipb_field_path'])) ) {
return FALSE;
}
ini_set( 'display_errors', 0 );
// Keep the board from redirecting
// https://community.invisionpower.com/tracker/issue-26224-issues-with-ssiphp/
define('CCS_GATEWAY_CALLED',FALSE);
require_once( $this->options['ipb_field_path'] .'/initdata.php' );
require_once( IPS_ROOT_PATH .'sources/base/ipsController.php' );
require_once( IPS_ROOT_PATH .'sources/base/ipsRegistry.php' );
$registry = ipsRegistry::instance();
$registry->init();
// build the select statement, skip the original post, we just want the replies
$registry->DB()->build( array( 'select' => 'posts',
'from' => 'topics',
'where' => 'tid = ' . $topic_id
)
);
$result = $registry->DB()->execute();
if ( $result ) {
$num = $registry->DB()->fetch();
return $num['posts'];
}
}
and:
function get_topic_ID () {
$post_ID = get_the_ID();
$meta = get_post_meta($post_ID,'forum_topic_meta');
extract($meta[0]);
return $topic_id;
}
And anywhere on your wordpress page, for example in comments.php, you can display how many replies has the topic corresponding to the post with this:
$ipb_comments = new WP_IPBComments;
echo "topic id: ".$topicID = $ipb_comments->get_topic_ID();
echo "replies number: ". $ipb_comments->get_replies_number($topicID);