51% connect-learnpress-discord-add-on

Code Review | Connect LearnPress to Discord

WordPress plugin Connect LearnPress to Discord scored51%from 54 tests.

About plugin

  • Plugin page: connect-learnpres...
  • Plugin version: 1.0.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.3
  • WordPress version: 6.3.1
  • First release: Jul 18, 2022
  • Latest release: Sep 8, 2023
  • Number of updates: 14
  • Update frequency: every 30.1 days
  • Top authors: expresstechsoftware (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,191 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.29MB] [CPU: ▼2.11ms] Passed 4 tests

Server-side resources used by Connect LearnPress to Discord
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.3046.34 ▲5.38
Dashboard /wp-admin3.59 ▲0.2552.30 ▼9.02
Posts /wp-admin/edit.php3.70 ▲0.3554.46 ▲3.48
Add New Post /wp-admin/post-new.php6.21 ▲0.3392.01 ▼6.76
Media Library /wp-admin/upload.php3.52 ▲0.2941.66 ▲3.86
Scheduled Actions /wp-admin/tools.php?page=action-scheduler3.6753.00
Discord Settings /wp-admin/admin.php?page=learnpress-discord-settings3.5947.47

Server storage [IO: ▲1.05MB] [DB: ▲0.01MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • Illegal file modification found: 1 file (0.00KB) outside of "wp-content/plugins/connect-learnpress-discord-add-on/" and "wp-content/uploads/"
    • (new file) wp-content/acfec78f-b5a2-4daf-b23b-6c6d6015944dlearnpress_discord_api_logs.txt
Filesystem: 128 new files
Database: 4 new tables, 26 new options
New tables
wp_actionscheduler_claims
wp_actionscheduler_actions
wp_actionscheduler_groups
wp_actionscheduler_logs
New WordPress options
widget_recent-posts
widget_theysaidso_widget
ets_learnpress_discord_send_welcome_dm
db_upgraded
ets_learnpress_discord_job_queue_concurrency
ets_learnpress_discord_job_queue_batch_size
theysaidso_admin_options
schema-ActionScheduler_StoreSchema
ets_learnpress_discord_uuid_file_name
ets_learnpress_discord_disconnect_button_text
...

Browser metrics Passed 4 tests

Connect LearnPress to Discord: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,819 ▲7313.27 ▼1.111.64 ▼0.0840.19 ▼7.51
Dashboard /wp-admin2,222 ▲225.77 ▼0.0998.52 ▼9.2742.50 ▲1.57
Posts /wp-admin/edit.php2,104 ▲12.03 ▼0.0236.54 ▼3.7537.81 ▲1.84
Add New Post /wp-admin/post-new.php1,558 ▲3218.51 ▲1.02625.10 ▼54.7364.89 ▲1.53
Media Library /wp-admin/upload.php1,404 ▲44.14 ▼0.0795.59 ▼16.3643.61 ▼5.00
Scheduled Actions /wp-admin/tools.php?page=action-scheduler1,2281.8826.9331.98
Discord Settings /wp-admin/admin.php?page=learnpress-discord-settings1,5402.6760.1042.84

Uninstaller [IO: ▲0.00MB] [DB: ▲0.01MB] 25% from 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/connect-learnpress-discord-add-on/uninstall.php+17
    Undefined index: plugin
  • This plugin does not fully uninstall, leaving 4 tables in the database
    • wp_actionscheduler_claims
    • wp_actionscheduler_groups
    • wp_actionscheduler_logs
    • wp_actionscheduler_actions
  • This plugin did not uninstall successfully, leaving 26 options in the database
    • ets_learnpress_discord_welcome_message
    • schema-ActionScheduler_LoggerSchema
    • ets_learnpress_discord_disconnect_button_text
    • action_scheduler_hybrid_store_demarkation
    • ets_learnpress_discord_course_complete_message
    • ets_learnpress_discord_send_course_complete_dm
    • widget_theysaidso_widget
    • widget_recent-posts
    • ets_learnpress_discord_send_lesson_complete_dm
    • schema-ActionScheduler_StoreSchema
    • ...

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for 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
Please fix the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/connect-learnpress-discord-add-on/public/partials/learnpress-discord-addon-public-display.php
  • 51× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php on line 4
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/classes/abstracts/ActionScheduler_Abstract_ListTable.php on line 4
    • > PHP Fatal error
      Uncaught Error: Interface 'ActionScheduler_Schedule' not found in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/deprecated/ActionScheduler_Schedule_Deprecated.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_SimpleSchedule' not found in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/classes/schedules/ActionScheduler_CanceledSchedule.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sanitize_text_field() in wp-content/plugins/connect-learnpress-discord-add-on/admin/partials/pages/learnpress_discord_error_log.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_Abstract_Schedule' not found in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/classes/abstracts/ActionScheduler_Abstract_RecurringSchedule.php:6
    • > PHP Fatal error
      Uncaught Error: Interface 'CronExpression_FieldInterface' not found in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_AbstractField.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_Schedule_Deprecated' not found in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CLI_Command' not found in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/classes/WP_CLI/Migration_Command.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'CronExpression_AbstractField' not found in wp-content/plugins/connect-learnpress-discord-add-on/includes/libraries/action-scheduler/lib/cron-expression/CronExpression_DayOfMonthField.php:21

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=learnpress-discord-settings
    • > Javascript (severe) in unknown
    /wp-content/plugins/connect-learnpress-discord-add-on/admin/js/learnpress-discord-addon-admin.js?ver=1.0.6 388:55 Uncaught TypeError: $(...).wpColorPicker is not a function
    • > GET request to /wp-admin/admin.php?page=learnpress-discord-settings
    • > Console-api (severe) in unknown
    /wp-content/plugins/connect-learnpress-discord-add-on/admin/js/learnpress-discord-addon-admin.js?ver=1.0.6 141:12 Object

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
Please take inspiration from this readme.txt

connect-learnpress-discord-add-on/learnpress-discord-addon.php 77% from 13 tests

"Connect LearnPress to Discord" version 1.0.6's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("connect-learnpress-discord-add-on.php" instead of "learnpress-discord-addon.php")
  • Description: The description should be shorter than 140 characters (currently 255 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin10,598 lines of code in 115 files:
LanguageFilesBlank linesComment linesLines of code
PHP1041,8565,1439,423
CSS41120630
JavaScript44043380
Markdown3610165

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity12.76
▷ Minimum class complexity1.00
▷ Maximum class complexity163.00
Average method complexity2.69
▷ Minimum method complexity1.00
▷ Maximum method complexity41.00
Code structure
Namespaces2
Interfaces3
Traits0
Classes84
▷ Abstract classes1517.86%
▷ Concrete classes6982.14%
▷ Final classes00.00%
Methods640
▷ Static methods6910.78%
▷ Public methods48475.62%
▷ Protected methods13220.62%
▷ Private methods243.75%
Functions49
▷ Named functions4285.71%
▷ Anonymous functions714.29%
Constants41
▷ Global constants921.95%
▷ Class constants3278.05%
▷ Public constants32100.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
3 PNG files occupy 0.31MB with 0.16MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/ravisoni.png278.09KB110.22KB▼ 60.36%
admin/images/icon.png24.25KB9.03KB▼ 62.78%
admin/images/ets-logo.png11.34KB7.55KB▼ 33.46%