bbPress database integration on WordPress

Integrare i dati di un forum bbPress in WordPress e’ estremamente semplice, soprattutto se il database e’ lo stesso e cambia solo il prefix delle tabelle. Quindi se avete un blog WordPress con associato un forum bbPress bastera’ creare delle corrette query nel template di WordPress per ottenere i dati del forum collegato.

Per esempio, per ottenere la lista dei forums disponibli potete usare qualcosa come questo:

<h2>Support Forums</h2>
$bb_forums = $wpdb->get_results(
"SELECT * FROM bb_forums ORDER BY topics DESC"

foreach ($bb_forums as $bb_forum) {

print "<li><a href=\"/".$bb_forum->slug."\"


Oppure per visualizzare la lista degli ultimi 5 topic aggiornati:

<h2>Latest Forum's Topics</h2>
$bb_topics = $wpdb->get_results(
"SELECT * FROM bb_topics ORDER BY topic_start_time DESC LIMIT 5");
$bb_posts = array();

foreach($bb_topics as $bb_topic){

$bb_first_post = $wpdb->get_results(
"SELECT post_text FROM bb_posts
WHERE post_position = '1'
AND topic_id = $bb_topic->topic_id", ARRAY_A);

$bb_post->post_date = $bb_topic->topic_start_time;
$bb_post->post_title = $bb_topic->topic_title;
$bb_post->post_name = "forums/topic/".$bb_topic->topic_slug;
$bb_post->comment_count = $bb_topic->topic_posts;

print "<li><a href=\"/".$bb_post->post_name."\"
<br /><a href=\"/".$bb_post->post_name."\"
title=\"".$bb_post->post_title."\" >
".$bb_post->comment_count." comments</a>
- ".$bb_post->post_date."</li>";


Potete vedere un esempio pratico nel sito di WassUp, il plugin WordPress per le statistiche che sviluppo e mantengo da tempo.

Tags: , , , , , , ,

Post simili:

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

6 Responses to “bbPress database integration on WordPress”
  1. qMYpezessy
    09:16 on September 18th, 2011

    Nome molto interessante dal forum

    Il mio è tema molto interessante. Suggerisco tutti a partecipare più attivamente alla discussione .

    Il possesso di un potere illimitato farà un despota di quasi ogni uomo.

    Buy- buy !

  2. chat
    20:34 on May 23rd, 2011

    Very nice great we are from greece.

  3. Haliablex
    23:47 on January 30th, 2011

    viagra young people
    Any upper crust that would give up up moral a little to autonomy to gain a bit security settle upon deserve neither and lose both.

  4. cebu image
    07:29 on September 2nd, 2009

    i want to test or apply this in my blog but unfortunately the wording is not global standard

  5. moralde
    13:16 on June 21st, 2009

    I hope someone could translate the articles in this website. I have a feeling that its contents are useful for newbie bloggers like me. Any takers to the challenge?

  6. India Property
    12:50 on May 25th, 2009

    bbPress integration should work with most recent version of WordPress in the 2.5.x series. You should upgrade your blog before trying to get WordPress and bbPress talking to each other.

Leave a comment