Info
- 15 posts
- 6 voices
- Started 5 years ago by Sam Bauers
- Latest reply from GTim
- This topic is not resolved
Slug based permalinks
-
- Posted 5 years ago #
Now available in the latest build in subversion.
Get permalinks like this:
http://www.example.org/forum/my-cool-forum
...and this...
http://www.example.org/topic/मैं-काँच-खा-सकता-हूँ
...and this...
http://www.example.org/profile/sambauers
All with the flick of a variable...
bb->mod_rewrite = 'slugs'...set in config.php
-
- Posted 5 years ago #
Just what I have been waiting for real pretty permalinks. Thank you =)
-
- Posted 5 years ago #
Great,
I am preparing to run this patch on a fresh installed version. -
- Posted 5 years ago #
It's in the core code, no need to patch. Just grab the very latest version via Subversion.
-
- Posted 5 years ago #
Nice,
I've installed it on http://www.dfur.com/. Is there a way to configure the links like the http://www.network.net.au/bbpress/patches/permalinks/teaser.gifThanx.
-
- Posted 5 years ago #
No there is no permalink configuration in the admin area, and plans for that permalink functionality have been dropped for several reasons.
You have three choices for $bb->mod_rewrite:
- false = normal querystring based links
- true = permalinks based on ID
- 'slugs' = permalinks based on item names/titles
-
- Posted 5 years ago #
So literally:
$bb->mod_rewrite = 'slugs';That works with the latest TRAC?
Trent
**Edit** Nevermind, it does works!
-
- Posted 5 years ago #
Hey Sam,
it's been working fine until someone made a thread called "1:28". The slug set for it in the database is "128" but going to /topic/128?replies=1 redirects to /topic/?replies=1, resulting in an error. I assume this is a bug? My quick fix for this was to just change the slug. -
- Posted 5 years ago #
fel64: I kind of knew this was going to be an issue, but never addressed it. I figured people would work out what to do (as you have). I guess it's worth a ticket, if you add the ticket to the bbpress trac, I'll patch it.
-
- Posted 5 years ago #
I've just written a fix, I'll add a ticket for it.
Edit: ticket added with patch...
-
- Posted 5 years ago #
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_topicis 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>". $bb_table_prefix ."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>". $bb_table_prefix ."forums</code> SET topics = topics + 1 WHERE forum_id = $forum"); $wpdb->query("UPDATE <code>". $bb_table_prefix ."forums</code> SET posts = posts + 1 WHERE forum_id = $forum"); } else { $otherdb->query("INSERT INTO <code>". $bb_table_prefix ."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>". $bb_table_prefix ."forums</code> SET topics = topics + 1 WHERE forum_id = $forum"); $otherdb->query("UPDATE <code>". $bb_table_prefix ."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?
-
- Posted 5 years ago #
Check out what we do with slugs in bb-includes/functions.php in the bb_new_topic() function...
In fact, why aren't you just using that function in that plugin???
-
- Posted 5 years ago #
It's a wordpress plugin! I don't think I can call bb_new_topic() from wordpress?
-
- Posted 5 years ago #
Oh.
-
- Posted 5 years ago #
This is the only thing that I missed when I first installed bbPress. Thanks!
-
You must log in to post.