78% membership-for-woocommerce

Code Review | Membership For WooCommerce - Add Simple Membership Plans, Recurring Revenue, Product Tags & Send Emails To Members with WooCommerce Membership

WordPress plugin Membership For WooCommerce - Add Simple Membership Plans, Recurring Revenue, Product Tags & Send Emails To Members with WooCommerce Membership scored78%from 54 tests.

About plugin

  • Plugin page: membership-for-wo...
  • Plugin version: 2.3.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.2
  • WordPress version: 6.3.1
  • First release: Mar 12, 2021
  • Latest release: Oct 31, 2023
  • Number of updates: 54
  • Update frequency: every 17.8 days
  • Top authors: makewebbetter (57.41%)wpswings (42.59%)Otto42 (3.7%)

Code review

54 tests

User reviews

11 reviews

Install metrics

600+ active /17,035 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼11.26ms] Passed 4 tests

An overview of server-side resources used by Membership For WooCommerce - Add Simple Membership Plans, Recurring Revenue, Product Tags & Send Emails To Members with WooCommerce Membership
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0038.80 ▼4.73
Dashboard /wp-admin3.31 ▼0.0444.75 ▼22.19
Posts /wp-admin/edit.php3.36 ▲0.0045.78 ▼1.90
Add New Post /wp-admin/post-new.php5.89 ▲0.0092.43 ▼16.20
Media Library /wp-admin/upload.php3.23 ▲0.0034.19 ▲0.82

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 205 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_recent-posts
db_upgraded
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Membership For WooCommerce - Add Simple Membership Plans, Recurring Revenue, Product Tags & Send Emails To Members with WooCommerce Membership: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.37 ▼0.281.82 ▲0.1642.95 ▼2.43
Dashboard /wp-admin2,198 ▲185.58 ▼0.0390.30 ▲3.4539.96 ▼4.34
Posts /wp-admin/edit.php2,100 ▼02.01 ▲0.0338.77 ▲1.6935.89 ▲0.74
Add New Post /wp-admin/post-new.php1,526 ▼823.17 ▲5.02699.28 ▲83.5060.89 ▼11.80
Media Library /wp-admin/upload.php1,403 ▼04.15 ▼0.0796.12 ▼10.4944.14 ▼1.63

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for 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/membership-for-woocommerce/public/partials/membership-for-woocommerce-public-display.php
    • > /wp-content/plugins/membership-for-woocommerce/common/partials/membership-for-woocommerce-common-display.php
  • 7× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/membership-for-woocommerce/onboarding/templates/membership-for-woocommerce-onboarding-template.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_user_logged_in() in wp-content/plugins/membership-for-woocommerce/admin/partials/templates/membership-templates/wps-membership-template.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/membership-for-woocommerce/admin/partials/templates/membership-templates/wps-membership-overview.php:27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function language_attributes() in wp-content/plugins/membership-for-woocommerce/public/partials/templates/membership-templates/wps-membership-template.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/membership-for-woocommerce/index.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shipping_Method' not found in wp-content/plugins/membership-for-woocommerce/admin/classes/class-wps-membership-free-shipping-method.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Shipping_Method' not found in wp-content/plugins/membership-for-woocommerce/public/classes/class-wps-membership-free-shipping-method.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% 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
These attributes need to be fixed:
  • Requires php: Invalid version format
You can take inspiration from this readme.txt

membership-for-woocommerce/membership-for-woocommerce.php 92% from 13 tests

The main PHP script in "Membership For WooCommerce - Add Simple Membership Plans, Recurring Revenue, Product Tags & Send Emails To Members with WooCommerce Membership" version 2.3.3 is automatically included on every request by WordPress
The following require your attention:
  • Description: The description should be shorter than 140 characters (currently 384 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin57,253 lines of code in 120 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript2410,51812,93834,668
PHP523,5863,62112,654
CSS221,0502887,528
PO File15808131,263
Sass11810805
JSON300202
Markdown376083
SVG130044
XML1206

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 113)
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity125.00
▷ Minimum class complexity1.00
▷ Maximum class complexity725.00
Average method complexity8.13
▷ Minimum method complexity1.00
▷ Maximum method complexity113.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes15
▷ Abstract classes00.00%
▷ Concrete classes15100.00%
▷ Final classes00.00%
Methods260
▷ Static methods93.46%
▷ Public methods24895.38%
▷ Protected methods31.15%
▷ Private methods93.46%
Functions38
▷ Named functions3694.74%
▷ Anonymous functions25.26%
Constants4
▷ Global constants4100.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
52 compressed PNG files occupy 0.97MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/resources/icons/banner.png332.71KB151.58KB▼ 54.44%
admin/image/Variable-product.png2.46KB2.45KB0.20%
admin/resources/icons/2.png8.43KB8.03KB▼ 4.81%
admin/image/star.png2.62KB2.67KB0.00%
admin/image/email-icon.png2.29KB2.03KB▼ 11.48%