Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [0.1.65](https://github.com/CodingBlackFemales/wordpress/compare/v0.1.64...v0.1.65) (2026-10-27)

### Features

* **academy:** show the front-end toolbar to content staff ([3e88372](https://github.com/CodingBlackFemales/wordpress/commit/3e883729afbd70b141bd62bf69280b443c09762f))

### Bug Fixes

* **academy:** read editorial comments on unpublished posts ([8ca1a9e](https://github.com/CodingBlackFemales/wordpress/commit/8ca1a9eead4d2662b35696ee906d15dc9ce2c1ae))

## [0.1.64](https://github.com/CodingBlackFemales/wordpress/compare/v0.1.63...v0.1.64) (2026-10-21)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cbf-wordpress",
"version": "0.1.64",
"version": "0.1.65",
"description": "[![Packagist](https://img.shields.io/packagist/v/roots/bedrock.svg?style=flat-square)](https://packagist.org/packages/roots/bedrock) [![Build Status](https://img.shields.io/travis/roots/bedrock.svg?style=flat-square)](https://travis-ci.org/roots/bedrock)",
"devDependencies": {
"@commitlint/cli": "^19.0",
Expand Down
39 changes: 39 additions & 0 deletions web/app/mu-plugins/cbf-content-board-revision-needs-work.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* Show the Revision Needs Work column on the PublishPress Content Board.
*
* PublishPress Statuses Pro defines the revision-needs-work status with the
* alternate flag set, and keeps it set wherever the status is positioned in
* the revision workflow. The Content Board skips alternate statuses when it
* builds its columns, so revisions in that status never appear on the board.
*
* Clearing the flag on copies of the status objects passed to the board shows
* the column. The originals are cached and shared with the workflow logic, so
* they are left unchanged.
*
* @package CBF
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

add_filter(
'publishpress_calendar_post_statuses',
static function ( $statuses ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( ! is_admin() || ! isset( $_GET['page'] ) || $_GET['page'] !== 'pp-content-board' || ! is_array( $statuses ) ) {
return $statuses;
}

foreach ( $statuses as $key => $status ) {
if ( is_object( $status ) && ( $status->slug ?? '' ) === 'revision-needs-work' && ! empty( $status->alternate ) ) {
$statuses[ $key ] = clone $status;
$statuses[ $key ]->alternate = false;
}
}

return $statuses;
},
20
);
71 changes: 71 additions & 0 deletions web/app/mu-plugins/cbf-staff-synced-patterns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/**
* Let content staff view synced patterns in the editor.
*
* WordPress maps reading a synced pattern (wp_block) to edit_posts, and the
* block editor fetches each pattern with context=edit, which needs edit_post on
* the pattern itself. Content Editors and Reviewers have neither, so every
* synced pattern in a lesson shows "Block has been deleted or is unavailable"
* and the inserter lists none.
*
* This lets anyone who can edit LearnDash courses (edit_courses) read published
* patterns, and serves their pattern requests in the view context, which still
* includes the raw markup the editor needs. They can't edit a pattern, so the
* editor hides "Edit original": patterns change in their source files and are
* synced with `wp cbf patterns sync`.
*
* @package CBF
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Whether a user is content staff without the core capability to read patterns.
*
* @param int $user_id User ID.
* @return bool
*/
function cbf_staff_synced_patterns_applies( int $user_id ): bool {
return $user_id && user_can( $user_id, 'edit_courses' ) && ! user_can( $user_id, 'edit_posts' );
}

add_filter(
'map_meta_cap',
static function ( array $caps, string $cap, int $user_id, array $args ): array {
if ( $cap !== 'read_post' || empty( $args[0] ) || ! cbf_staff_synced_patterns_applies( $user_id ) ) {
return $caps;
}

$post = get_post( $args[0] );

if ( ! $post || $post->post_type !== 'wp_block' || $post->post_status !== 'publish' ) {
return $caps;
}

return array( 'edit_courses' );
},
10,
4
);

add_filter(
'rest_request_before_callbacks',
static function ( $response, $handler, WP_REST_Request $request ) {
if (
$request->get_method() !== 'GET'
|| $request['context'] !== 'edit'
|| ! preg_match( '#^/wp/v2/blocks(?:/\d+)?$#', $request->get_route() )
|| ! cbf_staff_synced_patterns_applies( get_current_user_id() )
) {
return $response;
}

$request->set_param( 'context', 'view' );

return $response;
},
10,
3
);
Loading