58% simple-membership

Code Review | Simple Membership

WordPress plugin Simple Membership scored58%from 54 tests.

About plugin

  • Plugin page: simple-membership
  • Plugin version: 4.3.8
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.4
  • WordPress version: 6.3.1
  • First release: May 30, 2014
  • Latest release: Nov 13, 2023
  • Number of updates: 338
  • Update frequency: every 10.4 days
  • Top authors: mra13 (97.63%)wp.insider (2.66%)

Code review

54 tests

User reviews

381 reviews

Install metrics

50,000+ active /2,276,068 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲2.41MB] [CPU: ▲10.58ms] Passed 4 tests

This is a short check of server-side resources used by Simple Membership
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /5.93 ▲2.4653.91 ▲13.37
Dashboard /wp-admin5.72 ▲2.4160.75 ▲13.96
Posts /wp-admin/edit.php5.77 ▲2.4158.10 ▲13.79
Add New Post /wp-admin/post-new.php8.30 ▲2.4197.99 ▲1.30
Media Library /wp-admin/upload.php5.64 ▲2.4149.70 ▲13.84
Members /wp-admin/admin.php?page=simple_wp_membership5.8447.78
Payments /wp-admin/admin.php?page=simple_wp_membership_payments5.6746.66
Membership Levels /wp-admin/admin.php?page=simple_wp_membership_levels5.6244.98
Settings /wp-admin/admin.php?page=simple_wp_membership_settings5.6145.64
Add-ons /wp-admin/admin.php?page=simple_wp_membership_addons5.6645.36

Server storage [IO: ▲7.02MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 628 new files
Database: 4 new tables, 10 new options
New tables
wp_swpm_membership_tbl
wp_swpm_payments_tbl
wp_swpm_members_tbl
wp_swpm_membership_meta_tbl
New WordPress options
can_compress_scripts
theysaidso_admin_options
db_upgraded
swpm_private_key_one
swpm-settings
widget_recent-posts
widget_recent-comments
swpm_plugin_user_feedback_notice
swpm_db_version
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Simple Membership
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,937 ▲15013.34 ▼0.988.57 ▲6.7338.54 ▼9.14
Dashboard /wp-admin2,236 ▲595.67 ▲0.1586.37 ▼14.6439.40 ▼4.56
Posts /wp-admin/edit.php2,141 ▲412.00 ▼0.0236.05 ▲0.2435.45 ▲1.15
Add New Post /wp-admin/post-new.php6,266 ▲4,74018.72 ▼4.36893.00 ▲206.5954.42 ▼0.68
Media Library /wp-admin/upload.php1,441 ▲444.19 ▲0.0395.30 ▼10.4843.44 ▲0.13
Members /wp-admin/admin.php?page=simple_wp_membership1,3428.5191.7833.57
Payments /wp-admin/admin.php?page=simple_wp_membership_payments1,1212.0022.8528.99
Membership Levels /wp-admin/admin.php?page=simple_wp_membership_levels1,0498.5281.0128.49
Settings /wp-admin/admin.php?page=simple_wp_membership_settings1,1482.0022.8532.24
Add-ons /wp-admin/admin.php?page=simple_wp_membership_addons1,1781.9923.5276.97

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie tables detected upon uninstall: 4 tables
    • wp_swpm_membership_tbl
    • wp_swpm_membership_meta_tbl
    • wp_swpm_members_tbl
    • wp_swpm_payments_tbl
  • Zombie WordPress options detected upon uninstall: 10 options
    • db_upgraded
    • widget_theysaidso_widget
    • swpm-settings
    • swpm_plugin_user_feedback_notice
    • can_compress_scripts
    • swpm_private_key_one
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • swpm_db_version

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means 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
Almost there! Just fix the following items
  • 4× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/simple-membership/views/admin_member_form_common_js.php
    • > /wp-content/plugins/simple-membership/lib/stripe-gateway/update_certs.php
    • > /wp-content/plugins/simple-membership/simple-wp-membership.php
    • > /wp-content/plugins/simple-membership/lib/stripe-gateway/build.php
  • 362× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Stripe\\Exception\\ExceptionInterface' not found in wp-content/plugins/simple-membership/lib/stripe-gateway/lib/Exception/OAuth/ExceptionInterface.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Exception\\OAuth\\OAuthErrorException' not found in wp-content/plugins/simple-membership/lib/stripe-gateway/lib/Exception/OAuth/InvalidGrantException.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/simple-membership/lib/stripe-gateway/lib/OrderReturn.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/simple-membership/lib/braintree/lib/Braintree/Exception/Connection.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/simple-membership/lib/stripe-gateway/lib/ExternalAccount.php:10
    • > PHP Warning
      Use of undefined constant SIMPLE_WP_MEMBERSHIP_PATH - assumed 'SIMPLE_WP_MEMBERSHIP_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/simple-membership/lib/paypal/class-swpm-paypal-main.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/simple-membership/lib/stripe-gateway/lib/SubscriptionSchedule.php:31
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/simple-membership/views/payments/payment-gateway/admin_paypal_smart_checkout_button.php:228
    • > PHP Warning
      Use of undefined constant SIMPLE_WP_MEMBERSHIP_PATH - assumed 'SIMPLE_WP_MEMBERSHIP_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/simple-membership/lib/paypal/class-swpm-paypal-main.php on line 18
    • > PHP Warning
      include_once(): Failed opening 'SIMPLE_WP_MEMBERSHIP_PATHlib/paypal/onboarding-related/class-swpm-paypal-onboarding.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/simple-membership/lib/paypal/class-swpm-paypal-main.php on line 17

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

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Tags: There are too many tags (24 tag instead of maximum 10)
The official readme.txt might help

simple-membership/simple-wp-membership.php 92% from 13 tests

The main file in "Simple Membership" v. 4.3.8 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("simple-membership.php" instead of "simple-wp-membership.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Please fix the following items
  • For security reasons, never distribute binary or executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/simple-membership/lib/braintree/lib/ssl/api_braintreegateway_com.ca.crt
      • wp-content/plugins/simple-membership/lib/stripe-gateway/data/ca-certificates.crt
85,282 lines of code in 516 files:
LanguageFilesBlank linesComment linesLines of code
PO File3714,84219,26137,749
PHP4616,76512,42536,955
JavaScript82188219,171
Markdown36080891
CSS44715410
JSON10048
XML10031
make19027

PHP code Passed 2 tests

A brief analysis 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.25
Average class complexity7.67
▷ Minimum class complexity1.00
▷ Maximum class complexity130.00
Average method complexity2.34
▷ Minimum method complexity1.00
▷ Maximum method complexity37.00
Code structure
Namespaces24
Interfaces7
Traits7
Classes415
▷ Abstract classes153.61%
▷ Concrete classes40096.39%
▷ Final classes00.00%
Methods2,132
▷ Static methods79537.29%
▷ Public methods1,81585.13%
▷ Protected methods1265.91%
▷ Private methods1918.96%
Functions73
▷ Named functions6487.67%
▷ Anonymous functions912.33%
Constants1,463
▷ Global constants171.16%
▷ Class constants1,44698.84%
▷ Public constants1,446100.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
41 PNG files occupy 0.13MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/addons/google-first-click-free-addon.png2.33KB1.33KB▼ 43.02%
images/addons/swpm-woocommerce-addon.png2.99KB2.06KB▼ 31.14%
images/button-images/paypal-button-sample-image.png6.20KB2.53KB▼ 59.15%
images/addons/wp-user-import.png2.46KB1.43KB▼ 41.84%
css/images/ui-icons_777777_256x240.png6.83KB4.17KB▼ 38.92%