Skip to:
Content

bbPress.org

Opened 5 years ago

Closed 3 weeks ago

Last modified 3 weeks ago

#3403 closed enhancement (fixed)

Support the Gutenberg Block Editor.

Reported by: georgestephanis's profile georgestephanis Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.7 Priority: highest omg sweet tea
Severity: normal Version: trunk
Component: General - Administration Keywords: has-test-info has-screenshots has-patch commit
Cc: SirLouen

Description

Very much a work in progress, but this issue's goal is to add support for all existing bbPress shortcodes as blocks in the block editor.

https://codex.bbpress.org/features/shortcodes/

Attachments (2)

blocks.diff (7.7 KB) - added by georgestephanis 5 years ago.
Very coarse first pass. Only adds the forum index shortcode. More to come.
blocks.9oct2020.diff (15.7 KB) - added by georgestephanis 5 years ago.
Added in second block for displaying a single forum. Includes select dropdown.

Download all attachments as: .zip

Change History (29)

@georgestephanis
5 years ago

Very coarse first pass. Only adds the forum index shortcode. More to come.

#1 @georgestephanis
5 years ago

Very coarse first pass -- at this point the main question is more of tooling around the blocks to be added.

I'd added a npm run blocks to build them via parcel, but if y'all would prefer to tweak that to integrate with y'all's grunt tooling, that's fine. This is just the way I knew to set up the transpiling with as little friction as possible.

More to come as I continue fleshing out the other shortcodes.

@georgestephanis
5 years ago

Added in second block for displaying a single forum. Includes select dropdown.

#2 @georgestephanis
5 years ago

Just as this is going to be an ongoing thing, I'm working on this over at https://github.com/bbpress/bbPress/pull/4 -- which will update as I continue.

#3 @johnjamesjacoby
5 years ago

  • Milestone changed from Awaiting Review to Under Consideration
  • Owner set to georgestephanis
  • Status changed from new to assigned

I like where this is headed so far. Keep it up!

#4 @deborah86
5 years ago

I was just going to request this feature. The widgets will also need to be updated to blocks. Is this project dead?

#5 @johnjamesjacoby
5 years ago

Is this project dead?

No. New features are worked on by a smaller team of contributors than WordPress has. As such, progress is slower.

#6 @georgestephanis
5 years ago

Yup! Confirming that I'm still working on it, but most of the work is in GitHub. And when I sit down to work on it I keep getting yanked away by other issues. But it's in progress, and if you'd like to pitch in with it, please let me know! I'd be delighted to collab. :)

#7 @deborah86
5 years ago

@georgestephanis

I would love to pitch in. Just to let you know, I have never made a WordPress plugin before in my life. What can I do to help?

This ticket was mentioned in PR #4 on bbpress/bbPress by georgestephanis.


4 years ago
#8

  • Keywords has-patch added

#9 @johnjamesjacoby
19 months ago

  • Keywords needs-testing added
  • Milestone changed from Under Consideration to 2.7
  • Owner changed from georgestephanis to johnjamesjacoby
  • Priority changed from normal to highest omg sweet tea

@dd32 commented on PR #4:


17 months ago
#10

Branch restored. PR re-opened. This was accidental.
This PR doesn't need to be rebased to trunk, that'll be done by the committer.

#11 @SirLouen
14 months ago

  • Cc SirLouen added
  • Keywords has-testing-info has-screenshots added; has-patch needs-testing removed
  • Milestone changed from 2.7 to 2.6.12
  • Version set to trunk

Test Report

Following the excellent work by @georgestephanis and the revision by @adamsilverstein in Github PR 4, I'm trying to revive this feature and look forward to add it for the next 2.6.12 release as it's an important feature we all have been waiting for.

This report detects that previous patch has been tested in the current trunk branch and its not working. New patch has been submitted.

We have to remember, that the current implementation is a Shortcode-based Block adaptation, so we are mostly relying in the fact that core Shortcodes code is actually working well, although further testing has been taken to check if everything is in place.

Steps to Reproduce the Issue

Option A (original patch)

  1. Rebase original patch straight on trunk branch.
  2. Opening a new Page and checking for the new blocks
  3. 🐞 Bug occurs, blocks are not appearing

Option B (manually applied patch)

  1. Extract only block related changes and merge them into current trunk branch manually
  2. Follow steps 2 & 3 from Option A

Expected Results

  • Blocks should appear in the Gutenberg block list
  • Blocks should be able to be applied and shown in the frontend

Environment

  • OS: Windows 11
  • Web Stack: WP-Env 10.8
  • WordPress: 6.8-alpha-59336
  • Browser: Chrome 130.0.6723.92
  • Theme: Twenty Twenty
  • Active Plugins:
    • bbPress 2.7.0-alpha-2
    • Query Monitor 3.16.4

Actual Results

Testing with the original patch

  • ❌ Error condition occurs, blocks don't appear in the Gutenberg block list

Patch Additions

  1. I've extracted all the upgrades and implemented them into the current trunk
  2. Build was failing as-is so I have introduced some mods in my patch
  3. I have introduced some extras like a bbPress category to add all the blocks to such category.
  4. Rebuilt some blocks to make them work with the current status of WP

Results after testing with the new reviewed bugfix patch:

  • ✅ Blocks now appear in the Block list under the category (screenshot attached)
  • ✅ Forums Index worked out of the box (screenshot attached)
  • ✅ Forum Form worked out of the box (screenshot attached)
  • ❌ Single Forum Block doesn't work out of the box, changes introduced (see below)
  • ✅ Topics Index (Recent Topics) worked out of the box (screenshot attached)
  • ❌ New Topic Form worked out of the box but not as intended (see below)
  • ✅ Single Topic Block works out of the box (screenshot attached)
  • ❌ New Reply Form doesn't work. But is under-documented in the Codex and under-coded in BBP_Shortcodes Class (screenshots attached)
  • ✅ Single Reply Block works out of the box (screenshot attached)
  • ✅ Topic Tags Cloud Block works out of the box (screenshot attached)
  • ✅ Single Topic Tags Block works out of the box (screenshot attached)
  • ✅ Single View Block works out of the box (screenshot attached)
  • ✅ Search Results Block works out of the box (screenshot attached)
  • ✅ Search Form Block works out of the box (screenshot attached)
  • ✅ Login Form Block works out of the box (screenshot attached)
  • ✅ Register Form Block works out of the box (screenshot attached)
  • ✅ Lost Password Form Block works out of the box (screenshot attached)
  • ✅ Statistics block worked out of the box. (screenshot attached)

Current patch only introduces a first draft of bbPress Gutenberg Blocks directly matched with their current shortcode.

  • Single Forum Block: Changes in forum selector using settings according to latest Gutenberg styling (using sidebar), and proof of concept RangeControl to select number of topics (screenshots attached)
  • New Topic Form Block: After patching in ForumPicker React Component, ForumPicker is not helping display the form for the Forum selected. Some fixing done (screenshot attached)
  • New Reply Form left commented since it is not fully implemented and failing, the underlying issue is in the Shortcode implementation, doesn't specify where the reply is going to be placed , left for a future Block feature implementation

Supplemental Artifacts

Blocks in the bbPress Category

Forum Index in Gutenberg
Forum Index in Frontend

Single Forum in Gutenberg
Single Forum in Frontend (with 10 topics restriction selected)

Forum Form in Gutenberg
Forum Form in Fronted

Topic Index in Gutenberg
Topic Index in Frontend

New Topic Form in Gutenberg with no Forum
New Topic Form in Frontend with no Forum
New Topic Form in Gutenberg with Forum Selected
New Topic Form in Frontend with Forum Selected

Single Topic in Gutenberg
Single Topic in Frontend

Reply Form in Frontend

Single Reply in Gutenberg
Single Reply in Frontend

Topic Tag Cloud in Gutenberg
Topic Tags Cloud in Frontend

Single Topic Tag in Gutenberg
Single Topic Tag in Frontend

Single View in Gutenberg No Replies
Single View in Frontend No Replies
Single View in Gutenberg Popular
Single View in Frontend Popular

Search Results in Gutenberg
Search Results in Frontend

Search Form in Gutenberg
Search Form in Frontend

Login Form in Gutenberg
Login Form in Frontend

Register Form in Gutenberg
Register Form in Frontend

Lost Password Form in Gutenberg
Lost Password Form in Frontend

Forum Statistics in Gutenberg
Forum Statistics in Frontend

Further Development for 2.7 and 3.0

  1. Sort failing blocks like New Reply Form
  2. Moving inputs from Gutenberg's rendering area to Inspector component (Single Topic, Single Reply, Single Topic Tag, Single View, Search Results)
  3. I've only introduced some extra controls in the Single Forum Block, but ideally all blocks should have more controls, not only to edit functionality (like number of posts shown in the Single Forum list), but also the appearance (since, this is the true nature of Gutenberg).
  4. Blocks like Single Topic, Single Reply, Single View instead of using a ComboboxControl component with a good indexed search selector, they simply use a TextControl component so user can manually input their desired number, which doesn't feel right according to current design patterns. This should be also improved in the future.
  5. Instead of a Placeholder block, a preview should be rendered in the Editor.

This ticket was mentioned in PR #30 on bbpress/bbPress by @SirLouen.


14 months ago
#12

  • Keywords has-patch added

Trac Issue:
https://bbpress.trac.wordpress.org/ticket/3403

Original PR #4

Props to @georgestephanis and @adamsilverstein for the original code and review of the code, respectively.

I hope this time we can close this PR 👍

@SirLouen commented on PR #4:


14 months ago
#13

@dd32 @JJJ new revamped and rebased version in #30
This PR can be closed now.

#14 @johnjamesjacoby
11 months ago

  • Milestone changed from 2.6.12 to 2.6.13

Move open tickets out of 2.6.12 and into 2.6.13.

@webmandesign commented on PR #30:


11 months ago
#15

Hi @SirLouen,

I can see your PR is adding blocks to bbPress.

I haven't tested this PR on a website, just checked your code, so take this feedback with a grain of salt.

I think the blocks will not resolve all bbPress views. I'm not sure if a view such as editing/splitting/merging Forum/Topic/Reply would work with these blocks?

To resolve these I've created **Enable bbPress for Block Themes** plugin (still waiting for a review at WPORG), which:

  1. Adds support for block templates in themes with simple code. This alone displays all bbPress content correctly using theme's page.html template (or other templates if they are available in the theme).
  2. Registers a new "bbPress content" block template that serves as bbPress content renderer. I introduced this template so the page.html can be used separately.

In addition to these, user can _optionally_ enable block editor support for bbPress post types (I can see your PR does that too), then create single/archive templates for these post types in Site Editor, and then disable the block editor support (so it is not allowed to use blocks in Forum/Topic/Reply content), while still keeping those custom templates.

Maybe @JJJ could provide feedback whether both approaches could be integrated in bbPress?

#16 @johnjamesjacoby
9 months ago

  • Milestone changed from 2.6.13 to 2.6.14

Move out of 2.6.13 and into 2.6.14.

#17 @chellycat
9 months ago

Hi @johnjamesjacoby! I’m very interested in block theme compatibility for bbPress — having worked on several projects that use bbPress with block themes, I know how valuable this would be in core. We’d love to learn more about what’s needed to make this happen and how we might be able to help.

We also have code we’ve developed to add compatibility, which we’d be happy to share in a separate PR if that would be helpful — though since there are already a lot of approaches here, we don’t want to add noise if it’s unnecessary. We’re also curious what the current blockers are for adding this to bbPress core. Thank you!

#18 @wordpressdotorg
9 months ago

  • Keywords has-test-info added; has-testing-info removed

#19 @johnjamesjacoby
7 months ago

  • Keywords needs-testing added
  • Milestone changed from 2.6.14 to 2.6.15

We also have code we’ve developed to add compatibility, which we’d be happy to share in a separate PR if that would be helpful — though since there are already a lot of approaches here, we don’t want to add noise if it’s unnecessary. We’re also curious what the current blockers are for adding this to bbPress core. Thank you!

I think it would be helpful, yes.

My only blocker is fully reviewing (and tweaking if needed) the PR from @SirLouen, as it seems right at a cursory.

(Though, I do wish it was simpler... 😅)

@johnjamesjacoby commented on PR #30:


3 weeks ago
#20

Will be committing a modified version of this into trunk (for 2.7) shortly.

Thank you @SirLouen for the effort here & everywhere else. 🐝

#21 @johnjamesjacoby
3 weeks ago

  • Keywords commit added; needs-testing removed
  • Milestone changed from 2.6.15 to 2.7

#22 @johnjamesjacoby
3 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7383:

API - Blocks: Introduce support for Gutenberg blocks.

This commit includes:

  • bbp_register_blocks sub-action
  • common/blocks.php to register all of the blocks via PHP
  • common/blocks directory that includes a subdirectory for each block.json file
  • admin/assets/js/blocks.js to add block previews & preliminary support for some controls
  • admin/assets/css/blocks.css to help block previews look modern & clean

Fixes #3403.

In trunk, for 2.7.

Props georgestephanis, adamsilverstein, SirLouen, johnjamesjacoby.

#24 @johnjamesjacoby
3 weeks ago

In 7384:

API - Blocks: Improve block previews

This commit attempts to improve the look of form elements & template notices in block previews.

See #3403.

In trunk, for 2.7.

#25 @johnjamesjacoby
3 weeks ago

In 7387:

API - Blocks: add support for Post and Page post types.

This commit ensures that both of the primary post types supported by WordPress core are explicitly supported by all blocks in their block.json files.

See #3403.

In trunk, for 2.7.

#26 @johnjamesjacoby
3 weeks ago

In 7388:

API - Blocks: fix supported post types.

This commit reverts most of r7387 for a simpler approach.

See #3403.

In trunk, for 2.7.

#27 @johnjamesjacoby
3 weeks ago

In 7389:

API - Blocks: Do not use the block editor for bbPress post types.

This commit ensures that the legacy (non-block, meta-box based) new/edit post GUI is still used, even though show_in_rest is set to true for the forum/topic/reply post types, by introducing a new function on top of the core use_block_editor_for_post_type filter.

This prevents admin-area edits from saving block-based content when it is not yet properly handled or supported for the 2.7.0 release, even though blocks are (via the shortcodes & theme compatibility APIs).

See #3403.

In trunk, for 2.7.

Note: See TracTickets for help on using tickets.