Skip to content

Conversation

@donnapep
Copy link
Contributor

@donnapep donnapep commented Aug 6, 2025

Fixes an issue reported by Team51:

When using Safety Net on a site with the Sensei plugin, the following warning was encountered:

Warning: Attempt to read property "display_name" on bool in /plugins/sensei-lms/includes/class-sensei-modules.php on line 2653

Proposed Changes

Check that $author is a WP_User object before trying to access the display_name property.

Though I wasn't able to reproduce the reported issue, this seems like a safe change.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • Code is tested on the minimum supported PHP and WordPress versions

@donnapep donnapep added this to the 4.25.1 milestone Aug 6, 2025
@donnapep donnapep self-assigned this Aug 6, 2025
@m1r0 m1r0 modified the milestones: 4.25.1, 4.25.2 Sep 24, 2025
Copilot AI review requested due to automatic review settings December 14, 2025 15:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a warning that occurs when attempting to access the display_name property on a boolean value instead of a WP_User object. The issue was reported when using the Sensei plugin with Safety Net.

Key changes:

  • Updated get_term_author() documentation to accurately reflect that it can return WP_User|false
  • Added type check to ensure $author is a WP_User instance before accessing its properties

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
includes/class-sensei-modules.php Updated function documentation and added type safety check before accessing $author->display_name property
changelog/fix-variable-type-mismatch Added changelog entry documenting the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m1r0 m1r0 modified the milestones: 4.25.2, 4.25.3 Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants