Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Slug based permalinks


fel64
Member

@fel64

Thanks a lot Sam!

Another problem I have is that the bb Post plugin doesn’t automatically add a slug. I tried addressing this but couldn’t make it work. The function bbpress_bb_new_topic is responsible for adding the topic to bb.

function bbpress_bb_new_topic( $title, $forum, $author, $author_name, $now ) {	// making new topic in bbPress
global $wpdb ,$otherdb;
$bb_table_prefix = bbpress_getoption('bb_prefix');

if ( $forum && $title ) {
if (bbpress_getoption('bb_other_base') === "no") {
$wpdb->query("INSERT INTO <code>&quot;. $bb_table_prefix .&quot;topics</code> (topic_title, topic_poster, topic_poster_name, topic_last_poster, topic_last_poster_name, topic_start_time, topic_time, forum_id ) VALUES ('$title', $author, '$author_name', $author, '$author_name', '$now', '$now', $forum)");
$topic_id = $wpdb->insert_id;

$wpdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET topics = topics + 1 WHERE forum_id = $forum");
$wpdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET posts = posts + 1 WHERE forum_id = $forum");
} else {
$otherdb->query("INSERT INTO <code>&quot;. $bb_table_prefix .&quot;topics</code> (topic_title, topic_poster, topic_poster_name, topic_last_poster, topic_last_poster_name, topic_start_time, topic_time, forum_id, topic_slug) VALUES ('$title', $author, '$author_name', $author, '$author_name', '$now', '$now', $forum, $feltopic_slug)");
$topic_id = $otherdb->insert_id;

$otherdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET topics = topics + 1 WHERE forum_id = $forum");
$otherdb->query("UPDATE <code>&quot;. $bb_table_prefix .&quot;forums</code> SET posts = posts + 1 WHERE forum_id = $forum");

}

return $topic_id;
} else {
return false;
}
}

What needs to be done? I need to change the INSERT INTO statement, by adding the column name to the list of columns and the variable I want to insert for that to the list of variables?

Skip to toolbar