Skip to:
Content

bbPress.org

Opened 10 years ago

Closed 4 years ago

Last modified 4 years ago

#2698 closed defect (bug) (invalid)

bbpress Permalink can't use /%post_id%

Reported by: janfeng's profile janfeng Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.4
Component: API - Rewrite Rules Keywords: needs-patch
Cc:

Description (last modified by netweb)

wordpress + bbpress , bbpress Permalink can't use /%post_id% .

more info: https://bbpress.org/forums/topic/omgthis-bug-two-years-fix-that-plz/

plz fix that :(

Edit: bbPress should allow topic permalinks to use the post ID e.g http://example.com/forums/topic/123/

Change History (22)

#2 @janfeng
10 years ago

Nobody care this bug ? oh my god . 2 years ago.... >_<...

#3 follow-up: @alex-ye
10 years ago

hmm.. it works fine for me :))
see for an example:
http://www.ar-wp.com/forums/topic/27119/

#4 in reply to: ↑ 3 ; follow-up: @janfeng
10 years ago

Replying to alex-ye:

hmm.. it works fine for me :))
see for an example:
http://www.ar-wp.com/forums/topic/27119/

Your link is error :

403
Forbidden

Access to this resource on the server is denied!

#5 in reply to: ↑ 4 ; follow-up: @alex-ye
10 years ago

Replying to janfeng:

Replying to alex-ye:

hmm.. it works fine for me :))
see for an example:
http://www.ar-wp.com/forums/topic/27119/

Your link is error :

403
Forbidden

Access to this resource on the server is denied!

Strange! .. it works fine for me.. maybe it's a server configuration problem or your IP in the blacklist.. anyway.. it's an example that you can do it with the existing bbPress code and the WordPress permalinks API..

what you will need to do.. is using add_permastruct() & add_rewrite_tag() functions to Add the numeric permalink structure for bbPress topics or replies. and then filter the "rewrite_rules_array" WP filter to change the bbPress topics or replies rewrite rules.. and finally change the the topic or reply link by filtering "post_type_link" WP filter.

Maybe.. the bbPress team can add some options in the backend to make this much more easier .. but it's not a bug ! .. it's a feature request.

Last edited 10 years ago by alex-ye (previous) (diff)

#6 in reply to: ↑ 5 @janfeng
10 years ago

Replying to alex-ye:

Replying to janfeng:

Replying to alex-ye:

hmm.. it works fine for me :))
see for an example:
http://www.ar-wp.com/forums/topic/27119/

Your link is error :

403
Forbidden

Access to this resource on the server is denied!

Strange! .. it works fine for me.. maybe it's a server configuration problem or your IP in the blacklist.. anyway.. it's an example that you can do it with the existing bbPress code and the WordPress permalinks API..

what you will need to do.. is using add_permastruct() & add_rewrite_tag() functions to Add the numeric permalink structure for bbPress topics or replies. and then filter the "rewrite_rules_array" WP filter to change the bbPress topics or replies rewrite rules.. and finally change the the topic or reply link by filtering "post_type_link" WP filter.

Maybe.. the bbPress team can add some options in the backend to make this much more easier .. but it's not a bug ! .. it's a feature request.

I tried the local and the server, can not be normal (is a bug).
I make sure this is a BUG !! because everyone is the same problem,It's a common problem (in china).
I set %post_id%,but only wordpress post is postid ,bbpres awalys postname.
Can u help me fix this bug ? I dont know how to code .
Thank you !

Last edited 10 years ago by janfeng (previous) (diff)

#7 follow-up: @alex-ye
10 years ago

This snippet should work fine for u. Copy and Paste it into your Hacks Plugin
https://gist.github.com/nash-ye/3d8e68d3df85b1759e39

#8 in reply to: ↑ 7 ; follow-up: @janfeng
10 years ago

Replying to alex-ye:

This snippet should work fine for u. Copy and Paste it into your Hacks Plugin
https://gist.github.com/nash-ye/3d8e68d3df85b1759e39

Thank you very much ! But I put this file into wp-content\plugins\ , nothing happen @_@ .

How to use this file ?

Last edited 10 years ago by janfeng (previous) (diff)

#9 in reply to: ↑ 8 ; follow-up: @alex-ye
10 years ago

Replying to janfeng:

Replying to alex-ye:

This snippet should work fine for u. Copy and Paste it into your Hacks Plugin
https://gist.github.com/nash-ye/3d8e68d3df85b1759e39

Thank you very much ! But I put this file into wp-content\plugins\ , nothing happen @_@ .

How to use this file ?

It's not a complete plugin!.. You can install Code Snippets plugin and use it to run the code.
https://wordpress.org/plugins/code-snippets/

#10 in reply to: ↑ 9 @janfeng
10 years ago

Replying to alex-ye:

Replying to janfeng:

Replying to alex-ye:

This snippet should work fine for u. Copy and Paste it into your Hacks Plugin
https://gist.github.com/nash-ye/3d8e68d3df85b1759e39

Thank you very much ! But I put this file into wp-content\plugins\ , nothing happen @_@ .

How to use this file ?

It's not a complete plugin!.. You can install Code Snippets plugin and use it to run the code.
https://wordpress.org/plugins/code-snippets/

Thank you ! I download code-snippets and activate this code . But bbpress still display postname >_<...

I dont know what's happen . And when I use /?p=123 ,the url will display /?topic=[postname] .

#11 follow-up: @alex-ye
10 years ago

This being a support topic.. (Sorry for that bbPress Team) :D

@janfeng it's my fault.. because I didn't make in mind that we will use Code Snippets plugin..

I updated the code, test it again.. and don't forget to click on the "Save Changes" button on the Permalink Options screen, this will fire the rewrite actions to run the code below:
https://gist.github.com/nash-ye/3d8e68d3df85b1759e39

I hope it works fine for you.. and no need to thank me in every comment ! :)

#12 in reply to: ↑ 11 @janfeng
10 years ago

Replying to alex-ye:

This being a support topic.. (Sorry for that bbPress Team) :D

@janfeng it's my fault.. because I didn't make in mind that we will use Code Snippets plugin..

I updated the code, test it again.. and don't forget to click on the "Save Changes" button on the Permalink Options screen, this will fire the rewrite actions to run the code below:
https://gist.github.com/nash-ye/3d8e68d3df85b1759e39

I hope it works fine for you.. and no need to thank me in every comment ! :)

Oh my god ! It's work !! I'm so happy . You are god of my heart.
You should make this a simple plugin. There will be a lot of people to thank you _

#13 @alex-ye
10 years ago

Happy to hear that :) .. I will try to make it as a plugin in my weekend _

#14 follow-up: @netweb
10 years ago

  • Component changed from General to Rewrite Rules
  • Description modified (diff)
  • Priority changed from omg sweet tea to normal
  • Summary changed from [This BUG two years] bbpress Permalink can't use /%post_id% to bbpress Permalink can't use /%post_id%

The following plugin and discussion has been ongoing the past month and the plugin is evolving nicely:

https://bbpress.org/forums/topic/topic-id-instead-of-slugs/#post-151678
https://github.com/korobochkin/bbPress-permalinks-with-id

Time to go look at the status of WordPress permalink and the settings API per ticket:2258#comment:5

...until WordPress's Permalinks page uses the Settings API. I'd rather not add too many settings to our 1 forums page until that's addressed.

We can move this to appropriate milestone pending the status WordPress upstream and a patch.

#15 in reply to: ↑ 14 @janfeng
10 years ago

Replying to netweb:

The following plugin and discussion has been ongoing the past month and the plugin is evolving nicely:

https://bbpress.org/forums/topic/topic-id-instead-of-slugs/#post-151678
https://github.com/korobochkin/bbPress-permalinks-with-id

Time to go look at the status of WordPress permalink and the settings API per ticket:2258#comment:5

...until WordPress's Permalinks page uses the Settings API. I'd rather not add too many settings to our 1 forums page until that's addressed.

We can move this to appropriate milestone pending the status WordPress upstream and a patch.

Thanks , but bbpress-permalinks-with-id can't edit the reply . alex-ye's code is work.

Last edited 10 years ago by janfeng (previous) (diff)

#16 @korobochkin
10 years ago

Hi. Hm. So strange what https://github.com/korobochkin/bbPress-permalinks-with-id doesn't work. I use this plugin on my project and reply edit link work correctly. My plugin have a bug on activation and deactivation (seems like flushing doesn't work).

Version 0, edited 10 years ago by korobochkin (next)

#17 @netweb
10 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

#18 @korobochkin
10 years ago

just update my super-duper plugin :) now it works fine with all permalink setups. Checkout — https://github.com/korobochkin/bbPress-permalinks-with-id

Known issue
If permalink looks like site.com?p=123 (not pretty permalink), the topic and reply edit links looks like:

site.com/?post_type=topic&p=814&topic=TOPIC_SLUG&edit=1
// TOPIC_SLUG — I dont known right now how to delete it but works fine with this parameter.

My code which generate the permalink (without &topic=):

return home_url ('?post_type=' . bbp_get_topic_post_type () . '&p=' . $post->ID);

#19 follow-up: @korobochkin
10 years ago

Don't forget about links for group forums and topics (BuddyPress). I can't find how BuddyPress generate this type of links. Any suggestions?

#20 in reply to: ↑ 19 @netweb
10 years ago

Replying to korobochkin:

Don't forget about links for group forums and topics (BuddyPress). I can't find how BuddyPress generate this type of links. Any suggestions?

Most of what you would be looking for will be in /src/includes/extend/buddypress/groups.php, I haven't had a close look at #2704 yet but "some slugs" are hard coded for BuddyPress at the moment that we also need to look at.

This ticket was mentioned in Slack in #bbpress by netweb. View the logs.


9 years ago

#22 @mribrahimkhlalil
4 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

hmm.. it works fine for me :))
see for an example:
https://ibrahimkhlil.com/

Last edited 4 years ago by mribrahimkhlalil (previous) (diff)
Note: See TracTickets for help on using tickets.