Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of deprecated parameters in WordPress Core functions #7724

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

donnapep
Copy link
Collaborator

@donnapep donnapep commented Jan 10, 2025

Partial fix for https://github.com/Automattic/sensei-security/issues/19.

Proposed Changes

  • Deprecates the get_term_authors function as I was unable to find any calls to it either in Sensei or any of its extensions. It was first added here, which didn't call the function either. 😕
  • Fixes instances of the wp_count_terms function to pass a single parameter.
  • Fixes instances of the get_terms function to pass a single parameter.

There is one more deprecation fix needed in the class-sensei-learners-main.php file. The problem line is part of what appears to be obsolete code, so I'm planning to remove it in a separate PR.

Testing Instructions

  1. On trunk, enable usage tracking.
  2. Using the WP Crontrol plugin, run the sensei_usage_tracking_send_usage_data job.
  3. Find the sensei_stats_log event in Tracks and note the value of modules_max and modules_min.
  4. Switch to this branch.
  5. Re-run the sensei_usage_tracking_send_usage_data job and ensure the values noted in step 3 are the same.
  6. On the front-end, browse to a page containing the Course List block.
  7. Filter the list on a particular category and ensure only courses with that category are displayed.
  8. Add the [sensei_course_categories exclude="123,xxx"] shortcode to a page, where 123 is a course category ID and xxx is a course category slug to exclude.
  9. Ensure that all course categories, save the excluded ones, are displayed on the frontend.
  10. Go to Sensei LMS > Questions.
  11. Ensure that all question categories appear in the categories dropdown.
  12. Activate the Classic Editor plugin.
  13. Open an existing lesson.
  14. In the Quiz Questions panel, select the Category Questions tab.
  15. Ensure that all question categories appear in the dropdown.

Deprecated Code

  • Sensei_Core_Modules::get_term_authors

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 self-assigned this Jan 10, 2025
@donnapep donnapep added this to the 4.24.5 milestone Jan 10, 2025
I can't find any calls to it in Sensei or any extensions. This is the commit where it was originally added and wasn't being called anywhere at that time either - 18676be.
@donnapep donnapep force-pushed the fix/wordpress-core-deprecations branch from 9b19080 to 9b90058 Compare January 10, 2025 17:04
Copy link

Test the previous changes of this PR with WordPress Playground.

@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
@Automattic Automattic deleted a comment from github-actions bot Jan 10, 2025
Copy link

Test the previous changes of this PR with WordPress Playground.

@donnapep donnapep requested a review from m1r0 January 10, 2025 17:28
@donnapep donnapep added the Deprecation This change introduces a deprecation. label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecation This change introduces a deprecation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant