Skip to content

Instantly share code, notes, and snippets.

@ntwb
Created December 30, 2013 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntwb/757232d2260c5bce7b2f to your computer and use it in GitHub Desktop.
Save ntwb/757232d2260c5bce7b2f to your computer and use it in GitHub Desktop.
bbPress Standalone/Legacy v1.2 Database Queries
SELECT
forums.forum_id AS forum_id,
forums.forum_parent AS forum_parent,
forums.topics AS topics,
forums.posts AS posts,
forums.forum_name AS forum_name,
forums.forum_slug AS forum_slug,
forums.forum_desc AS forum_desc,
forums.forum_order AS forum_order,
meta.meta_value AS meta_value
FROM bb_forums AS forums
LEFT JOIN bb_meta AS meta
ON meta.object_id = forums.forum_id AND meta.meta_key = "forum_is_category";
SELECT
topics.topic_id AS topic_id,
topics.topic_posts AS topic_posts,
topics.forum_id AS forum_id,
topics.topic_poster AS topic_poster,
topics.topic_title AS topic_title,
topics.topic_slug AS topic_slug,
posts.post_text AS post_text,
posts.post_status AS post_status,
posts.poster_ip AS poster_ip,
topics.topic_sticky AS topic_sticky,
topics.topic_start_time AS topic_start_time,
topics.topic_time AS topic_time
FROM bb_topics AS topics
INNER JOIN bb_posts AS posts
USING (topic_id)
WHERE posts.post_position IN (0,1)
SELECT
posts.post_id AS post_id,
posts.topic_id AS topic_id,
posts.forum_id AS forum_id,
topics.topic_title AS topic_title,
topics.topic_slug AS topic_slug,
posts.poster_ip AS poster_ip,
posts.poster_id AS poster_id,
posts.post_status AS post_status,
posts.post_text AS post_text,
posts.post_position AS post_position,
posts.post_time AS post_time
FROM bb_posts AS posts
INNER JOIN bb_topics AS topics
USING (topic_id)
WHERE posts.post_position NOT IN (0,1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment