Notifications
Clear all

wpForo 1.x.x [Solved] Set Forum home page to custom post type

6 Posts
2 Users
2 Reactions
997 Views
Posts: 6
Topic starter
(@tsd_gregg)
Active Member
Joined: 5 years ago

I have a plugin that is overriding the permalink rules on my "page" post type, which interferes with the forum links. There is an option on that plugin to disable the behavior for certain post types. So, I created a new post type to host the forum landing page, and changed the post type of the forum home page, but when I did so - it created a new post of the "page" post type, and used that for the root of the forum. Is there a way to set the post to accept a custom post type? Is there a register_post_type param that needs to be set in order for this to work?

 

Thanks!

Gregg

5 Replies
Alvina
Posts: 1862
Moderator
(@alvina)
Member
Joined: 5 years ago

Hi @tsd_gregg,

Posted by: @tsd_gregg

Is there a way to set the post to accept a custom post type?

I'm sorry but currently we don't have such functionality. The code designed to works on the "page" content type.

Also, please describe in detail why you can't do what you want by using the "page" content type?

1 Reply
(@tsd_gregg)
Joined: 5 years ago

Active Member
Posts: 6

@alvina Good morning!

This was actually something that I was able to work out myself - I needed to modify the plugin core, which is a bummer - but I'm going to be maintaining the codebase, so I'll make it work. It's actually not a huge update, if you wanted to work it into the plugin yourself. You just need to tweak the db calls to find/set the root page, and update the rewrite rule to pass a post_type variable to said root page. From what I can tell, everything is working fine, once you get the forum to properly understand where the root is supposed to be. From there, you could choose the root of the forum via a select dropdown and just put a note telling the user to put the shortcode in place. From an ease of setup standpoint, I see why the root page selection process works the way it does - but I feel like it may impose an arbitrary limit on functionality. It's a great plugin and I'm very happy with it 🙂

As for why I feel compelled to do this seemingly pointless task - my client has installed a "permalink manager" plugin that's overriding the set rewrite rules - which interferes with the forums internal links. The client has used the renamer plugin to set manual rewrites to over 100 pages on the site, so we aren't allowed to touch it, fortunately, the plugin has an option to select post types to ignore. Hence, my need to use a different post type.

From what I can tell so far, everything is working fine. I'm able to create posts, reply to them, like posts, etc.

 

Thanks for the quick response!

Gregg

Posts: 6
Topic starter
(@tsd_gregg)
Active Member
Joined: 5 years ago

I spoke too soon! It looks like non-logged-in users aren't having their current_object set properly when navigating to the root url of the forum, so the ?foro=login link breaks.

I manually re-set the missing values to $this->GET in init_current_object() and that's bringing up the missing pages. Other than that, we're sailing smoothly.

2 Replies
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@tsd_gregg,

We've discussed with our team and decided, that we won't be able to implement the functionality.
This requires a large change in the plugin core.

(@tsd_gregg)
Joined: 5 years ago

Active Member
Posts: 6

@alvina

I can't say that I blame you. We only needed to use it in a minor portion of the plugin's overall functionality, so I implemented some more changes to core that I'm sure would cause bugs down the road. I am a huge fan of your plugin, and I hope that I can implement it more in the future.

 

Thanks so much for your responses!
Gregg