Search

bbPress Showcase » bbPress Chat

  1. spewf
    User has not uploaded an avatar

    new member
    Joined: Nov '10
    Posts: 3

    offline

    I have a script that I made that pulls the count of posts a user does on bbpress and displays it on wordpress page template. For some reason I can't get it to work. I know I need to add something to wordpress but I am not sure what. Here is the script so far.

    function get_user_posts_forums1($user_id) {
    global $wpdb; // I know I need to change this
    $count = $bbdb->get_results("
    SELECT COUNT( * ) AS total
    FROM {$bbdb->posts}
    WHERE poster_id = {$user_id};", object);
    
    return $count[0]->total;
    
    }

    I have also tried:

    function get_user_posts_forums1($user_id) {
          define('ABSPATH', dirname(__FILE__).'/');
          require_once('/home/username/public_html/hr/forums/bb-config.php');
          global $wpdb;
           $count = $wpdb->get_results("SELECT COUNT(*) FROM bb_posts WHERE poster_id = {$user_id} AND post_status = 0");
    
      return $count[0]->total;
    }

    Still can't seem to get it to work.

    On the second script I can get it to pull the total number of posts on the forum but not per user.

    Posted 1 year ago #

RSS feed for this topic

Post a reply to “BBPress Count In Wordpress”

You must log in to post.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
43 users online from in the past 30 minutes. 19 bots 24 guests
3,525 views today 8,638 yesterday 16,043 peak. Most at once 47 today 60 yesterday 131 peak. Visited today: qamilon, pandoracam, lvgalliera
2,288 posts in 394 topics over 66 months by 430 of 2,165 members. Latest: qwe12345100, Janvelden, watchessaleus