67% learnpress

Code Review | LearnPress - WordPress LMS Plugin

WordPress plugin LearnPress - WordPress LMS Plugin scored67%from 54 tests.

About plugin

  • Plugin page: learnpress
  • Plugin version: 4.2.5.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2-6.4.1
  • WordPress version: 6.3.1
  • First release: Jun 7, 2015
  • Latest release: Nov 24, 2023
  • Number of updates: 845
  • Update frequency: every 3.8 days
  • Top authors: ThimPress (55.74%)tunnhn (24.5%)leehld (6.15%)kendy73 (5.09%)thongta (4.14%)

Code review

54 tests

User reviews

538 reviews

Install metrics

90,000+ active /3,846,348 total downloads

Benchmarks

Plugin footprint 64% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲10.07MB] [CPU: ▲73.33ms] 25% from 4 tests

A check of server-side resources used by LearnPress - WordPress LMS Plugin
Please fix the following
  • RAM: You should keep total memory usage under 10MB (currently 13.85MB on /wp-admin/edit-tags.php?taxonomy=course_tag)
  • CPU: You should keep total CPU usage under 500.00ms (currently 4,121.66ms on /wp-admin/admin.php?page=learn-press-themes)
  • Extra RAM: The extra memory usage should kept under 5MB (currently 10.07MB on /wp-admin/edit-tags.php?taxonomy=course_tag)
PageMemory (MB)CPU Time (ms)
Home /12.35 ▲8.88109.34 ▲69.03
Dashboard /wp-admin13.80 ▲10.45124.50 ▲61.64
Posts /wp-admin/edit.php13.83 ▲10.47127.22 ▲81.50
Add New Post /wp-admin/post-new.php17.00 ▲11.11185.40 ▲92.02
Media Library /wp-admin/upload.php13.72 ▲10.49118.48 ▲81.15
Themes /wp-admin/admin.php?page=learn-press-themes18.054,121.66
Tools /wp-admin/admin.php?page=learn-press-tools13.74107.75
Categories /wp-admin/edit-tags.php?taxonomy=course_category13.85109.43
Add-ons /wp-admin/admin.php?page=learn-press-addons13.69106.03
Settings /wp-admin/admin.php?page=learn-press-settings13.83120.67
Statistics /wp-admin/admin.php?page=learn-press-statistics13.71106.29
Tags /wp-admin/edit-tags.php?taxonomy=course_tag13.85101.59

Server storage [IO: ▲16.80MB] [DB: ▲0.56MB] Passed 3 tests

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 1,241 new files
Database: 13 new tables, 25 new options
New tables
wp_learnpress_user_item_results
wp_learnpress_user_items
wp_thim_cache
wp_learnpress_files
wp_learnpress_question_answers
wp_learnpress_section_items
wp_learnpress_sections
wp_learnpress_sessions
wp_learnpress_question_answermeta
wp_learnpress_order_itemmeta
...
New WordPress options
learn_press_instructors_page_id
table_learnpress_files_created
widget_recent-comments
thim_cache_tb_created
learnpress_version
widget_learnpress_widget_course_recent
widget_learnpress_widget_course_featured
learn_press_single_instructor_page_id
widget_learnpress_widget_course_popular
widget_learnpress_widget_course_info
...

Browser metrics Passed 4 tests

An overview of browser requirements for LearnPress - WordPress LMS Plugin
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,239 ▲49214.50 ▼0.211.87 ▲0.2540.46 ▼3.15
Dashboard /wp-admin2,616 ▲4365.87 ▲0.24122.28 ▲24.2799.03 ▲52.55
Posts /wp-admin/edit.php2,404 ▲3073.41 ▲1.3973.58 ▲35.3634.90 ▼2.42
Add New Post /wp-admin/post-new.php1,744 ▲20920.39 ▼4.71678.80 ▲17.3936.84 ▼35.48
Media Library /wp-admin/upload.php1,730 ▲3365.22 ▲1.06113.65 ▲18.8083.10 ▲42.32
Themes /wp-admin/admin.php?page=learn-press-themes3,1452.7946.3598.31
Tools /wp-admin/admin.php?page=learn-press-tools1,5788.85202.9532.97
Categories /wp-admin/edit-tags.php?taxonomy=course_category1,5393.0343.6251.32
Add-ons /wp-admin/admin.php?page=learn-press-addons5,3172.0445.2249.60
Settings /wp-admin/admin.php?page=learn-press-settings3,6943.2384.5593.28
Statistics /wp-admin/admin.php?page=learn-press-statistics1,3103.1556.5336.63
Tags /wp-admin/edit-tags.php?taxonomy=course_tag1,5142.7641.7361.27

Uninstaller [IO: ▲0.00MB] [DB: ▲0.56MB] 50% from 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • The uninstall procedure failed, leaving 13 tables in the database
    • wp_learnpress_user_item_results
    • wp_learnpress_order_itemmeta
    • wp_learnpress_section_items
    • wp_learnpress_user_items
    • wp_learnpress_question_answermeta
    • wp_thim_cache
    • wp_learnpress_user_itemmeta
    • wp_learnpress_sections
    • wp_learnpress_question_answers
    • wp_learnpress_order_items
    • ...
  • This plugin did not uninstall successfully, leaving 25 options in the database
    • thim_cache_tb_created
    • learn_press_term_conditions_page_id
    • learnpress_db_version
    • widget_learnpress_widget_course_popular
    • learn_press_instructors_page_id
    • widget_recent-comments
    • can_compress_scripts
    • learn_press_courses_page_id
    • learn_press_check_tables
    • widget_learnpress_widget_course_recent
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 68× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/learnpress/templates/emails/new-order-guest.php
    • > /wp-content/plugins/learnpress/templates/emails/instructor-denied.php
    • > /wp-content/plugins/learnpress/templates/emails/cancelled-order-admin.php
    • > /wp-content/plugins/learnpress/templates/emails/plain/instructor-denied.php
    • > /wp-content/plugins/learnpress/templates/emails/new-order-admin.php
    • > /wp-content/plugins/learnpress/templates/emails/completed-order-user.php
    • > /wp-content/plugins/learnpress/templates/emails/plain/finished-course-admin.php
    • > /wp-content/plugins/learnpress/templates/emails/plain/finished-course.php
    • > /wp-content/plugins/learnpress/templates/emails/cancelled-order-instructor.php
    • > /wp-content/plugins/learnpress/templates/emails/enrolled-course.php
  • 271× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'LearnPress\\ExternalPlugin\\Elementor\\Widgets\\Instructor\\SingleInstructorBaseElementor' not found in wp-content/plugins/learnpress/inc/ExternalPlugin/Elementor/Widgets/Instructor/Sections/InstructorAvatarElementor.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function learn_press_admin_view() in wp-content/plugins/learnpress/inc/admin/views/quiz/question-answer.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/learnpress/config/settings/course.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'LP_Abstract_Submenu' not found in wp-content/plugins/learnpress/inc/admin/sub-menus/class-lp-submenu-tags.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function learn_press_admin_view() in wp-content/plugins/learnpress/inc/admin/views/course/curriculum.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'LP_Email' not found in wp-content/plugins/learnpress/inc/emails/types/class-lp-email-type-order.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/learnpress/inc/lp-deprecated.php:224
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/learnpress/inc/admin/views/statistics/overview.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function learn_press_admin_view() in wp-content/plugins/learnpress/inc/admin/views/tools/html-course.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'LP_Meta_Box_Field' not found in wp-content/plugins/learnpress/inc/admin/views/meta-boxes/fields/autocomplete.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Donate link: Invalid URI found ("")
You can take inspiration from this readme.txt

learnpress/learnpress.php 92% from 13 tests

The principal PHP file in "LearnPress - WordPress LMS Plugin" v. 4.2.5.6 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 148 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected227,608 lines of code in 1,125 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript30010,11611,30094,053
PHP75417,02831,23977,372
CSS4180631332,249
SVG1301211,634
PO File23,6044,9747,434
XML310904,228
JSON730522
Markdown1600112
HTML42144

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity19.84
▷ Minimum class complexity1.00
▷ Maximum class complexity172.00
Average method complexity3.15
▷ Minimum method complexity1.00
▷ Maximum method complexity53.00
Code structure
Namespaces23
Interfaces1
Traits3
Classes380
▷ Abstract classes195.00%
▷ Concrete classes36195.00%
▷ Final classes41.11%
Methods3,364
▷ Static methods42312.57%
▷ Public methods2,97788.50%
▷ Protected methods2898.59%
▷ Private methods982.91%
Functions547
▷ Named functions51393.78%
▷ Anonymous functions346.22%
Constants117
▷ Global constants86.84%
▷ Class constants10993.16%
▷ Public constants109100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
30 PNG files occupy 0.10MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/src/css/vendor/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.08KB0.17KB0.00%
assets/images/jqueryui/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%
inc/gateways/offline-payment/images/cod.png20.24KB0.47KB▼ 97.67%
assets/images/jqueryui/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
assets/images/jqueryui/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%