From 5dda06743f77ea938e6f42c11b7ed2125a619a81 Mon Sep 17 00:00:00 2001 From: Genyus Date: Wed, 21 Oct 2026 02:55:57 +0000 Subject: [PATCH 1/3] chore(release): 0.1.64 --- CHANGELOG.md | 6 ++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b213edb..73edd599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ 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.64](https://github.com/CodingBlackFemales/wordpress/compare/v0.1.63...v0.1.64) (2026-10-21) + +### Bug Fixes + +* **academy:** apply Permissions course exceptions to LearnDash edit checks ([c2281a7](https://github.com/CodingBlackFemales/wordpress/commit/c2281a7d104b6b536cf57ede9bfa404649400e38)) + ## [0.1.63](https://github.com/CodingBlackFemales/wordpress/compare/v0.1.62...v0.1.63) (2026-10-20) ## [0.1.62](https://github.com/CodingBlackFemales/wordpress/compare/v0.1.61...v0.1.62) (2026-10-19) diff --git a/package-lock.json b/package-lock.json index 1d78cc87..f958985c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cbf-wordpress", - "version": "0.1.63", + "version": "0.1.64", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cbf-wordpress", - "version": "0.1.63", + "version": "0.1.64", "devDependencies": { "@commitlint/cli": "^19.0", "@commitlint/config-conventional": "^19.0", diff --git a/package.json b/package.json index 3be8915a..ae48815e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cbf-wordpress", - "version": "0.1.63", + "version": "0.1.64", "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", From 8ca1a9eead4d2662b35696ee906d15dc9ce2c1ae Mon Sep 17 00:00:00 2001 From: Genyus Date: Mon, 26 Oct 2026 11:53:33 -0400 Subject: [PATCH 2/3] fix(academy): read editorial comments on unpublished posts PublishPress Permissions filters comment queries to comments on posts with a readable status, so get_comments() returns no editorial comments for drafts and other unpublished posts. The editorial comments endpoint's read route returned nothing on them, and its duplicate check could not see existing comments, so a repeated note would be posted twice. Read the post's editorial comments directly from the comments table. The routes already check that the user can edit the post. --- .../mu-plugins/cbf-editorial-comments-api.php | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/web/app/mu-plugins/cbf-editorial-comments-api.php b/web/app/mu-plugins/cbf-editorial-comments-api.php index 16d1c2c0..65d21aa8 100644 --- a/web/app/mu-plugins/cbf-editorial-comments-api.php +++ b/web/app/mu-plugins/cbf-editorial-comments-api.php @@ -154,17 +154,32 @@ private static function module_options(): array { * @return WP_REST_Response */ public static function list_comments( WP_REST_Request $request ): WP_REST_Response { - $comments = get_comments( - array( - 'post_id' => (int) $request['id'], - 'type' => self::TYPE, - 'status' => self::TYPE, - 'orderby' => 'comment_date_gmt', - 'order' => 'ASC', - ) - ); + return rest_ensure_response( array_map( array( __CLASS__, 'prepare' ), self::comments_on( (int) $request['id'] ) ) ); + } + + + /** + * A post's editorial comments, oldest first, optionally only one user's. + * + * Reads the comments table directly rather than through get_comments(). + * PublishPress Permissions filters comment queries to comments on posts + * with a readable status, which hides every editorial comment on a draft + * or other unpublished post. The routes have already checked that the + * user can edit the post, which is the access these comments need. + * + * @param int $post_id Post ID. + * @param int|null $user_id Only this user's comments, if given. + * @return WP_Comment[] + */ + private static function comments_on( int $post_id, ?int $user_id = null ): array { + global $wpdb; + + $user_clause = $user_id === null ? '' : $wpdb->prepare( ' AND user_id = %d', $user_id ); + + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- see the docblock; $user_clause is prepared above. + $ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_post_ID = %d AND comment_type = %s AND comment_approved = %s{$user_clause} ORDER BY comment_date_gmt ASC, comment_ID ASC", $post_id, self::TYPE, self::TYPE ) ); - return rest_ensure_response( array_map( array( __CLASS__, 'prepare' ), $comments ) ); + return array_values( array_filter( array_map( 'get_comment', $ids ) ) ); } @@ -212,16 +227,7 @@ public static function create_comment( WP_REST_Request $request ) { * @return WP_Comment|null */ private static function find( int $post_id, string $content ): ?WP_Comment { - $comments = get_comments( - array( - 'post_id' => $post_id, - 'type' => self::TYPE, - 'status' => self::TYPE, - 'user_id' => get_current_user_id(), - ) - ); - - foreach ( $comments as $comment ) { + foreach ( self::comments_on( $post_id, get_current_user_id() ) as $comment ) { if ( $comment->comment_content === $content ) { return $comment; } From 3e883729afbd70b141bd62bf69280b443c09762f Mon Sep 17 00:00:00 2001 From: Genyus Date: Mon, 26 Oct 2026 14:54:00 -0400 Subject: [PATCH 3/3] feat(academy): show the front-end toolbar to content staff BuddyBoss's toolbar setting for non-admins is off so learners don't see the toolbar, but it also hides it from Content Editors, Reviewers and internal staff, who use it to reach the editor from a lesson. Show it to anyone who can edit LearnDash courses or other people's posts, respecting each user's own toolbar preference. --- web/app/mu-plugins/cbf-staff-toolbar.php | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 web/app/mu-plugins/cbf-staff-toolbar.php diff --git a/web/app/mu-plugins/cbf-staff-toolbar.php b/web/app/mu-plugins/cbf-staff-toolbar.php new file mode 100644 index 00000000..88c5edbb --- /dev/null +++ b/web/app/mu-plugins/cbf-staff-toolbar.php @@ -0,0 +1,34 @@ +