boonebgorges / buddypress-docs

GNU General Public License v3.0
106 stars 44 forks source link

No comments section showing for BP Docs #453

Closed nickharambee closed 8 years ago

nickharambee commented 9 years ago

For some reason I am not seeing a comments section below BP Docs. I have 'allow comments' enabled on the Docs. I am wondering if it has been hidden by CSS, but I can't see any HTML for the comments section on the page, so I am a little confused.

dcavins commented 9 years ago

Are comments enabled generally (setting is at /wp-admin/options-discussion.php)? Are you looking at a single doc (at /docs/doc-name) as a logged-in user?

StrothiP commented 9 years ago

Hey, I'm having the same issue. I've comments enabled system-wide for logged-in users, as well as on my documents directly. The entire discussion section is not showing. I added a comment in the backend, but that's also not showing. And I've tried that all with my admin account. The only place where my comment shows is the activity stream?! Any ideas?

boonebgorges commented 9 years ago

Can you please give details on the theme you're using? Specifically, is it a child of bp-default, a theme that specifically provides BP integration, or does the theme use theme-compatibility to work with BP?

StrothiP commented 9 years ago

Hey, thanks for getting back to me so fast! I'm using the Kleo Theme (http://seventhqueen.com/) with a Child Theme and the theme indeed is tailored specifically for BP, so that might cause the issue?

boonebgorges commented 9 years ago

Is it possible for you to send me a copy of the theme? My github user name at gmail.com. The only possibility I can think of is that they have a custom Docs template that hasn't been updated in years.

On 10/23/15 09:16, StrothiP wrote:

Hey, thanks for getting back to me so fast! I'm using the Kleo Theme (http://seventhqueen.com/) with a Child Theme and the theme indeed is tailored specifically for BP, so that might cause the issue?

— Reply to this email directly or view it on GitHub https://github.com/boonebgorges/buddypress-docs/issues/453#issuecomment-150586501.

boonebgorges commented 8 years ago

@StrothiP sent a copy of the theme, and I tracked down the issue, though I'm not entirely sure of the best general solution.

The Kleo theme, and other BP-compatible themes, contain top-level templates that are specific to BuddyPress content. In the case of Kleo, it's buddypress.php, though it could also be community.php or a number of other things. Sensibly enough, Kleo does not put a comment section in this template. BP Docs uses the top-level BuddyPress template, but it forces the native comment section to be turned off when theme compatibility is active (add_filter( 'bp_docs_allow_comment_section', '__return_false' );) because it assumes that the theme template will have a comment section - like single.php, singular.php, page.php, etc. (This is how it works in Twenty* themes.)

@StrothiP - For your case, and for others on the thread, you should be able to work around the problem by putting the following into your functions.php or somewhere else:

add_filter( 'bp_docs_allow_comment_section', '__return_true', 100 );

More generally, I'm not sure what to do. Maybe Docs should detect whether we're loading buddypress.php vs page.php or whatever, and load the comment section conditionally based on this. Or maybe we should have some sort of global flag that we use to prevent us from loading the comment template twice, and then remove the "allow comment section" disabling when using theme compat. @dcavins Any bright ideas here?

StrothiP commented 8 years ago

Thanks so much, your solution works like a charm :+1:

dcavins commented 8 years ago

@boonebgorges After thinking about this a bit, I wonder if it would make more sense to find some way to use a "normal" template part like single.php or page.php for the doc view and edit screens. It seems like those screens have a lot more in common with a typical blog article than the BP user or groups components. Huh, wouldn't it be great if WP had nice template stack logic (ha ha)?

boonebgorges commented 8 years ago

Yeah, it's a thought. The only thing there is that themes providing buddypress.php must be doing something really specific for BP content, which we'd then be missing out on. I guess I wouldn't mind looking into using a different top-level template in the long run, but in the short run, I think we need something that's less likely to wreak havoc with existing themes (like my lame only-load-comment-template-once trick).

On 10/24/15 21:07, David Cavins wrote:

@boonebgorges https://github.com/boonebgorges After thinking about this a bit, I wonder if it would make more sense to find some way to use a "normal" template part like |single.php| or |page.php| for the doc view and edit screens. It seems like those screens have a lot more in common with a typical blog article than the BP user or groups components. Huh, wouldn't it be great if WP had nice template stack logic (ha ha)?

— Reply to this email directly or view it on GitHub https://github.com/boonebgorges/buddypress-docs/issues/453#issuecomment-150882570.

dcavins commented 8 years ago

I've written a small patch that does some of what we've talked about. See it here: https://github.com/dcavins/buddypress-docs/commit/c6362ab407230da5fd4472f5ca19e07f1f6224a0

It works as expected with Boss, Kleo, Custom Community and the Twenties. I'll test it with other themes as I hear about them. Let me know if you have any thoughts or other ideas that are more foolproof. This approach relies on generally followed patterns, which will break in some cases, surely.

dcavins commented 8 years ago

Ha ha. I was fooling myself (and I don't believe). Boss has special cases for a single bp_doc view, and it includes a comments template. So there goes that idea.

dcavins commented 8 years ago

The Kleo theme developers have cheerfully added the filter: add_filter( 'bp_docs_allow_comment_section', '__return_true', 100 ); which will be included in an upcoming release, so Kleo and BP Docs will be better friends.

I'm closing this issue because it relates to Kleo specifically. If we need to have a "cleverly deciding when to include the comments section" more generally, we should open a new issue.