BuddyPress broke into the world of blocks last month with its 6.0 release. Group and Member blocks were the first blocks to make it into the core plugin and next up are block versions of the existing widgets. Contributors are also working on block requests based on community feedback.
Today, BuddyPress core developer Mathieu Viet shared a prototype of his early work on adding a block based Activity post form to BuddyPress. This is one of the most highly-requested features from the plugin’s community of developers, according to a recent poll.
Viet submitted a PR for a playground inside the WP Admin that allows posting to the activity stream via a custom
bp/text block. It is an adaptation of the basic
core/paragraph block with a modified block toolbar that removes unnecessary controls, such as alignments, text color, and strikethrough formatting.
The custom activity posting block adds a new emoji picker control to the block toolbar, with a popover that includes categories of all the emoji WordPress supports. This is far more convenient for users than launching their operating system’s emoji picker.
Viet’s PR highlighted several major benefits to bringing the block editor to activity posting: formatting text and adding links is more intuitive, inserting emoji is easier, and users can easily schedule activities using the block editor’s DateTimePicker component.
One of the biggest benefits Viet identified is the opportunity to standardize the UI. In the same way the block editor is helping WordPress unify the UI for publishing and site design, a block-based activity form will help standardize the UI for BuddyPress plugin developers.
“Today, when BuddyPress Plugin developers extend this post form, they do not have a structured way to process, they simply use a hook: it can be a very different one from plugin to plugin,” Viet said. “Plugins are mostly using jQuery (some can tidy this a bit using Backbone), UI controls can look very different. This is really not ideal for BuddyPress users. By extending the WordPress Blocks API to make available a BP Activity Blocks API we will improve all this and we’ll benefit from the ‘WordPress Blocks’ developers interest to give our users great new BP Activity Blocks to share richer content like media, or more interactive content like Polls.”
BuddyPress’ activity component is a frontend feature, so the idea is to test the block-based activity posting form in the admin and then work through the hurdles for bringing it to the frontend.
“Bringing this block based Activity post form in this area is the goal and a huge challenge mainly due to the fact we have less control over the layout,” Viet said. “There’s one WordPress administration layout, but there are thousands of different front-end layouts.”
Viet proposed BuddyPress tackle this in small steps:
- Making the block based Activity Post form only available from a WP admin screen
- Making the block based Activity Post form only available into a new complete “BP Default” theme
- Making the block based Activity Post form available from a modal
- Making the block based Activity Post form available from a new template pack
BuddyPress only supports WordPress 4.8+. If a block-based activity form is ready for inclusion in version 7.0 of the plugin, BuddyPress will need to raise the required WordPress version to 4.9. Sites running on older versions would be able to fall back to the legacy activity posting form.