Topic: combining num_posts on integrated punbb

So this might be a difficult one, so if anyone fancies a challenge here goes.

I have PunBB integrated with Coppermine Photo Gallery.

I want to have PunBB's forum rankings to be based on the combined totals of the users posts in punbb and comments in coppermine...so there is an incentive to make comments basically.

the MYSQL call to get the total number of comments for a coppermine user is this:
SELECT COUNT( * ) AS `Rows`
FROM `copper_comments`
WHERE author_id = XX

the XX is where you input the desired user id.

this is what I have tried to do to the get_title function in functions.php:        (excuse my nonsense variable names)

//added this code to create a variable - $bow - that contains the number of comments the current poster has made using coppermine
// poster_id will only work on viewtopic.php, for profile.php and userlist.php it should be $user['id'] or something- will need to maybe have 2 versions of this function.
    $dude = $user['poster_id'];
    $number_of_comments = sprintf("SELECT COUNT( * ) AS `Rows` FROM copper_comments WHERE author_id=$dude");
    $test = mysql_query($number_of_comments);
    $bow = mysql_fetch_assoc($test);
    $bow = $bow['Rows'];
//end of added code

        // Are there any ranks?
        if ($pun_config['o_ranks'] == '1' && !empty($pun_ranks))
        {
            
            @reset($pun_ranks);

            while (list(, $cur_rank) = @each($pun_ranks))
            {
//added a + $bow to add to the  num_posts to get the new total
                if (intval($user['num_posts'] + $bow) >= $cur_rank['min_posts'])
                    $user_title = pun_htmlspecialchars($cur_rank['rank']);
            }
        }

now i realize that poster_id will only work for viewtopic.php, if I use $user['id'] then this mod work fine when looking at the userlist.  When looking at viewtopic however with poster_id it works fine...the users rank is updated based on how many coppermine posts they have made but it will only show one post in any thread.  Even if there are many replies.

I am not sure exactly why this is happening.

Any help on this would be very much appreciated.

Would it be simpler to have coppermine add to num_posts row everytime someone makes a comment in coppermine?

Punbb w/coppermine and wordpress integrated

see my hack to integrate punbb with wordpress comment system.
Illustration Community