Support » Plugins and Hacks » [Plugin: IP.Board Comments] Adding number of forum replies

[Plugin: IP.Board Comments] Adding number of forum replies

Viewing 10 replies - 1 through 10 (of 10 total)
  • This would be amazing. Thank you for all of your hard work!

    Hi there! any news about this feature and/or the development of this mod?


    Shouldn’t this be really easy with the XML-RPC Api?

    Anyway, any updates?

    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
    		// http://community.invisionpower.com/tracker/issue-26224-issues-with-ssiphp/
    		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();
    		// 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'];	


    function get_topic_ID () {
    		$post_ID = get_the_ID();
    		$meta = get_post_meta($post_ID,'forum_topic_meta');
    		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);

    Thanks a lot, but it doesn’t work in my website (http://www.rpgitalia.net/ actually using WP 3.3): it gets the correct id and number of replies for the first two articles only, then i get a strange “www.rpgitalia.net Driver Error” message (instead of topic id) and the page stops from loading.

    golgoth, have you checked if the posts that give you the error got posted on the forum using IPB.Comments?
    That could be the problem.

    Oh yeah, now that you mention it that news is not in the forum. Is there a way to bypass that error not showing the number of comments?

    change get_topic_ID() in class.ipbcomments.php with this:

    function get_topic_ID () {
    		$post_ID = get_the_ID();
    		$meta = get_post_meta($post_ID,'forum_topic_meta');
    		if(!empty($meta)) {
    			return $topic_id;
    		} else {
    			return false;

    and in comments.php or whatever you want:

    $ipb_comments = new WP_IPBComments;
    	echo "wp post: ". get_the_ID() . "<br>";
    	$topicID = $ipb_comments->get_topic_ID();
    	if($topicID) {
    		echo "topic id:". $topicID;
    		echo "replies number: ". $ipb_comments->get_replies_number($topicID);
    	else {
    			echo "Forum post doesn't exist.";

    Perfect, thank you 🙂

    There are some news in my website which do not autopost into the forum because i manually write the “forum_topic_url” custom field during creation, since i want to link those news with already existing topics.

    Doing that way i noticed that forum_topic_meta doesn’t contain neither the last comments nor the total replies: is there a way to make wordpress “recreate” that field after adding a custom forum url?

    Thanks again

    Hello. When someone reply wp post related topici i want show teh replyies under wp post, like wp comments. Do you any script can do this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: IP.Board Comments] Adding number of forum replies’ is closed to new replies.