78% elearning-memberships

Code Review | ELM: Make Simple Membership Sites Minus the Headache

WordPress plugin ELM: Make Simple Membership Sites Minus the Headache scored78%from 54 tests.

About plugin

  • Plugin page: elearning-members...
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.5
  • WordPress version: 6.3.1
  • First release: Oct 9, 2019
  • Latest release: Aug 14, 2020
  • Number of updates: 13
  • Update frequency: every 24.8 days
  • Top authors: handsomeapps (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /695 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.46MB] [CPU: ▲1.39ms] Passed 4 tests

Server-side resources used by ELM: Make Simple Membership Sites Minus the Headache
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.95 ▲0.4946.95 ▲7.15
Dashboard /wp-admin3.79 ▲0.4951.85 ▲4.75
Posts /wp-admin/edit.php3.84 ▲0.4945.80 ▼1.42
Add New Post /wp-admin/post-new.php6.33 ▲0.4596.43 ▼4.92
Media Library /wp-admin/upload.php3.65 ▲0.4241.52 ▲8.18
Settings /wp-admin/edit.php?post_type=ristretto-elm&page=elm-settings3.6233.79
Members /wp-admin/edit.php?post_type=ristretto-elm&page=elm-members3.6332.83
Add New /wp-admin/post-new.php?post_type=ristretto-elm3.8348.68
Levels /wp-admin/edit.php?post_type=ristretto-elm3.7640.31

Server storage [IO: ▲0.21MB] [DB: ▲0.00MB] Passed 3 tests

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 27 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
elm_settings
widget_recent-posts
db_upgraded
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for ELM: Make Simple Membership Sites Minus the Headache
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,844 ▲8713.23 ▼1.191.65 ▼0.2742.99 ▲1.47
Dashboard /wp-admin2,242 ▲545.87 ▲0.0497.31 ▼4.0537.38 ▼9.43
Posts /wp-admin/edit.php2,128 ▲392.02 ▼0.0236.33 ▼0.1635.89 ▲5.07
Add New Post /wp-admin/post-new.php6,740 ▲5,22623.16 ▲5.48923.66 ▲257.9141.59 ▼14.75
Media Library /wp-admin/upload.php1,427 ▲454.18 ▼0.03114.04 ▲11.4047.65 ▲2.62
Settings /wp-admin/edit.php?post_type=ristretto-elm&page=elm-settings8341.6923.6026.73
Members /wp-admin/edit.php?post_type=ristretto-elm&page=elm-members1,0401.7226.7825.68
Add New /wp-admin/post-new.php?post_type=ristretto-elm2,3287.68169.0563.42
Levels /wp-admin/edit.php?post_type=ristretto-elm1,1251.9833.3431.77

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • elm_settings
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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 items
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/elearning-memberships/includes/admin/meta-boxes/class-elmedd-metabox.php
    • > /wp-content/plugins/elearning-memberships/includes/class-edd-registration.php
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/elearning-memberships/includes/templates/create-member-form.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 90% 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 need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Easy protection of posts and pages), #2 (Protection message to non-members with links to purchase associated levels), #3 (ELM settings page)
You can take inspiration from this readme.txt

elearning-memberships/elm.php 85% from 13 tests

"ELM: Make Simple Membership Sites Minus the Headache" version 1.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("elearning-memberships.php" instead of "elm.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected2,530 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP196391,0202,212
JavaScript33016194
CSS3188124

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity19.57
▷ Minimum class complexity2.00
▷ Maximum class complexity40.00
Average method complexity3.19
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes14
▷ Abstract classes00.00%
▷ Concrete classes14100.00%
▷ Final classes00.00%
Methods119
▷ Static methods1411.76%
▷ Public methods10890.76%
▷ Protected methods00.00%
▷ Private methods119.24%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin