57% paid-memberships-pro

Code Review | Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions

WordPress plugin Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions scored57%from 54 tests.

About plugin

  • Plugin page: paid-memberships-pro
  • Plugin version: 2.12.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.4.1
  • WordPress version: 6.3.1
  • First release: Jul 6, 2011
  • Latest release: Nov 16, 2023
  • Number of updates: 479
  • Update frequency: every 9.4 days
  • Top authors: strangerstudios (99.16%)andrewza (1.04%)

Code review

54 tests

User reviews

600 reviews

Install metrics

90,000+ active /5,336,820 total downloads

Benchmarks

Plugin footprint 64% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲5.84MB] [CPU: ▲56.92ms] 50% from 4 tests

This is a short check of server-side resources used by Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions
It is recommended to improve the following
  • RAM: You should keep total memory usage under 10MB (currently 12.21MB on /wp-admin/admin.php?page=pmpro-paymentsettings)
  • Extra RAM: The extra memory usage must be under 5MB (currently 5.84MB on /wp-admin/admin.php?page=pmpro-advancedsettings)
PageMemory (MB)CPU Time (ms)
Home /9.16 ▲5.69106.26 ▲65.16
Dashboard /wp-admin9.22 ▲5.91100.76 ▲48.45
Posts /wp-admin/edit.php9.27 ▲5.92113.86 ▲71.81
Add New Post /wp-admin/post-new.php11.85 ▲5.96144.57 ▲47.84
Media Library /wp-admin/upload.php9.07 ▲5.8497.76 ▲66.22
Email Templates /wp-admin/admin.php?page=pmpro-emailtemplates9.2891.13
Orders /wp-admin/admin.php?page=pmpro-orders9.3986.99
Reports /wp-admin/admin.php?page=pmpro-reports9.26123.46
User Fields /wp-admin/admin.php?page=pmpro-userfields9.2783.77
Members /wp-admin/admin.php?page=pmpro-memberslist9.2786.29
Setup Wizard /wp-admin/admin.php?page=pmpro-wizard9.0683.00
Add Ons /wp-admin/admin.php?page=pmpro-addons10.08100.92
Email Settings /wp-admin/admin.php?page=pmpro-emailsettings9.28109.64
Payment Settings /wp-admin/admin.php?page=pmpro-paymentsettings12.21142.95
Advanced Settings /wp-admin/admin.php?page=pmpro-advancedsettings9.33102.52

Server storage [IO: ▲30.52MB] [DB: ▲0.28MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Just a few items left to fix
  • Total filesystem usage should be limited to 25MB (currently using 30.52MB)
Filesystem: 1,279 new files
Database: 10 new tables, 17 new options
New tables
wp_pmpro_memberships_users
wp_pmpro_membership_ordermeta
wp_pmpro_membership_levelmeta
wp_pmpro_discount_codes_levels
wp_pmpro_memberships_pages
wp_pmpro_membership_orders
wp_pmpro_memberships_categories
wp_pmpro_membership_levels
wp_pmpro_discount_codes
wp_pmpro_discount_codes_uses
New WordPress options
wisdom_admin_emails
wisdom_block_notice
wisdom_collect_email
wisdom_allow_tracking
wisdom_notification_times
pmpro_dismissed_wp_pointers
widget_pmpro-member-login
wisdom_last_track_time
db_upgraded
pmpro_views
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,920 ▲15813.76 ▼0.951.74 ▼0.0338.37 ▼6.83
Dashboard /wp-admin2,285 ▲1115.07 ▼0.47106.06 ▼2.1345.89 ▼0.13
Posts /wp-admin/edit.php2,197 ▲972.16 ▲0.1741.42 ▲1.5741.23 ▲2.96
Add New Post /wp-admin/post-new.php1,820 ▲28427.22 ▲4.05696.47 ▲88.5037.98 ▼7.73
Media Library /wp-admin/upload.php1,567 ▲1674.60 ▲0.44104.05 ▼1.5345.60 ▼1.04
Email Templates /wp-admin/admin.php?page=pmpro-emailtemplates1,6872.4140.6657.57
Orders /wp-admin/admin.php?page=pmpro-orders1,5452.3037.7942.76
Reports /wp-admin/admin.php?page=pmpro-reports1,4655.3969.8853.10
User Fields /wp-admin/admin.php?page=pmpro-userfields1,3442.4751.0938.33
Members /wp-admin/admin.php?page=pmpro-memberslist1,4792.3938.1042.98
Setup Wizard /wp-admin/admin.php?page=pmpro-wizard1,1252.1735.6439.23
Add Ons /wp-admin/admin.php?page=pmpro-addons7,4622.3044.44189.17
Email Settings /wp-admin/admin.php?page=pmpro-emailsettings1,1352.4295.53110.37
Payment Settings /wp-admin/admin.php?page=pmpro-paymentsettings2,3942.4044.5148.85
Advanced Settings /wp-admin/admin.php?page=pmpro-advancedsettings1,6612.3740.4146.23

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie tables detected upon uninstall: 10 tables
    • wp_pmpro_discount_codes
    • wp_pmpro_membership_levelmeta
    • wp_pmpro_discount_codes_levels
    • wp_pmpro_membership_ordermeta
    • wp_pmpro_memberships_users
    • wp_pmpro_membership_orders
    • wp_pmpro_membership_levels
    • wp_pmpro_discount_codes_uses
    • wp_pmpro_memberships_pages
    • wp_pmpro_memberships_categories
  • The uninstall procedure has failed, leaving 17 options in the database
    • pmpro_visits
    • widget_theysaidso_widget
    • pmpro_views
    • wisdom_last_track_time
    • widget_pmpro-member-login
    • pmpro_dismissed_wp_pointers
    • widget_recent-comments
    • pmpro_logins
    • wisdom_allow_tracking
    • wisdom_notification_times
    • ...

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 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 24× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/paid-memberships-pro/blocks/account-page/block.php
    • > /wp-content/plugins/paid-memberships-pro/blocks/login/block.php
    • > /wp-content/plugins/paid-memberships-pro/classes/class-deny-network-activation.php
    • > /wp-content/plugins/paid-memberships-pro/adminpages/admin_footer.php
    • > /wp-content/plugins/paid-memberships-pro/blocks/account-profile-section/block.php
    • > /wp-content/plugins/paid-memberships-pro/blocks/billing-page/block.php
    • > /wp-content/plugins/paid-memberships-pro/scheduled/expirationwarnings.php
    • > /wp-content/plugins/paid-memberships-pro/scheduled/expirememberships.php
    • > /wp-content/plugins/paid-memberships-pro/scheduled/trialendingwarnings.php
    • > /wp-content/plugins/paid-memberships-pro/blocks/account-invoices-section/block.php
  • 497× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Base' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Braintree/lib/Braintree/CreditCard.php:31
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Exception\\ApiErrorException' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Stripe/lib/Exception/OAuth/OAuthErrorException.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function pmpro_getOption() in wp-content/plugins/paid-memberships-pro/includes/content.php:275
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Stripe/lib/FinancialConnections/AccountOwner.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/paid-memberships-pro/adminpages/emailsettings.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Exception' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Braintree/lib/Braintree/Exception/InvalidChallenge.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Stripe/lib/FinancialConnections/Session.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Instance' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Braintree/lib/Braintree/Transaction/AmexExpressCheckoutCardDetails.php:31
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Stripe/lib/Treasury/OutboundTransfer.php:39
    • > PHP Fatal error
      Uncaught Error: Class 'Braintree\\Http' not found in wp-content/plugins/paid-memberships-pro/includes/lib/Braintree/lib/Braintree/GraphQL.php:10

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)
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 16 tag instead of maximum 10
The official readme.txt might help

paid-memberships-pro/paid-memberships-pro.php Passed 13 tests

"Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions" version 2.12.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
86 characters long description:
The most complete member management and membership subscriptions plugin for WordPress.

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Please fix the following items
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/paid-memberships-pro/includes/lib/Braintree/lib/ssl/api_braintreegateway_com.ca.crt
      • wp-content/plugins/paid-memberships-pro/includes/lib/Stripe/data/ca-certificates.crt
233,356 lines of code in 1,049 files:
LanguageFilesBlank linesComment linesLines of code
PO File2972,024439,943157,755
PHP67112,40729,63266,122
JavaScript393144873,043
CSS74531352,868
HTML29588302,838
Markdown21560424
SQL13051162
Bourne Shell22119141
SVG3003

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
These items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 120)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity8.98
▷ Minimum class complexity1.00
▷ Maximum class complexity678.00
Average method complexity2.58
▷ Minimum method complexity1.00
▷ Maximum method complexity120.00
Code structure
Namespaces61
Interfaces9
Traits9
Classes485
▷ Abstract classes132.68%
▷ Concrete classes47297.32%
▷ Final classes00.00%
Methods2,503
▷ Static methods82232.84%
▷ Public methods2,21388.41%
▷ Protected methods1034.12%
▷ Private methods1877.47%
Functions723
▷ Named functions70196.96%
▷ Anonymous functions223.04%
Constants1,781
▷ Global constants271.52%
▷ Class constants1,75498.48%
▷ Public constants1,754100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
107 PNG files occupy 2.07MB with 0.92MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/add-ons/pmpro-membership-maps.png15.09KB7.36KB▼ 51.26%
images/add-ons/pmpro-donations.png14.73KB6.59KB▼ 55.27%
images/add-ons/pmpro-sponsored-members.png20.64KB8.71KB▼ 57.82%
images/add-ons/pmpro-payfast.png26.05KB10.88KB▼ 58.22%
images/select2.png0.60KB0.99KB0.00%