73% restrict-user-access

Code Review | Restrict User Access - Membership & Content Protection

WordPress plugin Restrict User Access - Membership & Content Protection scored73%from 54 tests.

About plugin

  • Plugin page: restrict-user-access
  • Plugin version: 2.4.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Mar 16, 2015
  • Latest release: Jul 4, 2023
  • Number of updates: 87
  • Update frequency: every 34.9 days
  • Top authors: intoxstudio (100%)

Code review

54 tests

User reviews

89 reviews

Install metrics

20,000+ active /485,969 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 gracefully, with no errors

Server metrics [RAM: ▲5.68MB] [CPU: ▲27.71ms] 75% from 4 tests

An overview of server-side resources used by Restrict User Access - Membership & Content Protection
Please take the time to fix the following items
  • Extra RAM: The extra memory usage must be under 5MB (currently 5.68MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.20 ▲5.7471.91 ▲35.86
Dashboard /wp-admin9.22 ▲5.8778.81 ▲19.14
Posts /wp-admin/edit.php9.22 ▲5.8686.60 ▲36.85
Add New Post /wp-admin/post-new.php11.12 ▲5.23119.64 ▲18.99
Media Library /wp-admin/upload.php9.22 ▲5.9971.31 ▲36.92
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius9.2267.32

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 277 new files
Database: no new tables, 11 new options
New WordPress options
can_compress_scripts
_ca_condition_type_cache
theysaidso_admin_options
fs_active_plugins
fs_accounts
db_upgraded
rua_plugin_version
fs_debug_mode
widget_recent-comments
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

A check of browser resources used by Restrict User Access - Membership & Content Protection
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,873 ▲12714.52 ▼0.081.76 ▲0.0429.44 ▼13.88
Dashboard /wp-admin2,254 ▲635.86 ▼0.04105.54 ▲4.6440.29 ▼5.77
Posts /wp-admin/edit.php2,143 ▲542.01 ▼0.0440.82 ▼1.1638.77 ▼1.96
Add New Post /wp-admin/post-new.php1,533 ▲422.94 ▼0.43687.45 ▲30.2351.41 ▼7.38
Media Library /wp-admin/upload.php1,435 ▲504.20 ▲0.0295.40 ▼4.9146.66 ▲2.89
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,0981.8524.8627.45

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/restrict-user-access/lib/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • This plugin did not uninstall successfully, leaving 11 options in the database
    • widget_theysaidso_widget
    • rua_plugin_version
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • _ca_condition_type_cache
    • fs_debug_mode
    • fs_active_plugins
    • db_upgraded
    • widget_recent-posts
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
The following issues need your attention
  • 23× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/restrict-user-access/lib/wp-content-aware-engine/view/condition_options.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'RUA_Level_Interface' not found in wp-content/plugins/restrict-user-access/models/level.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'RUA_Role_Member_Automator' not found in wp-content/plugins/restrict-user-access/automators/user_role_sync.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'RUA_Member_Automator' not found in wp-content/plugins/restrict-user-access/automators/user_role.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'RUA_App' not found in wp-content/plugins/restrict-user-access/view/meta_box_member_triggers.php:9
    • > PHP Notice
      Trying to get property 'post_status' of non-object in wp-content/plugins/restrict-user-access/view/meta_box_publish.php on line 14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/restrict-user-access/lib/wp-content-aware-engine/view/meta_box.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'RUA_Member_Automator' not found in wp-content/plugins/restrict-user-access/automators/edd_product.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'RUA_Members_List' not found in wp-content/plugins/restrict-user-access/view/meta_box_members.php:9
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/restrict-user-access/view/meta_box_publish.php on line 14

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were 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
Attributes that need to be fixed:
  • Donate link: Invalid URI found ("#")
Please take inspiration from this readme.txt

restrict-user-access/restrict-user-access.php 92% from 13 tests

"Restrict User Access - Membership & Content Protection" version 2.4.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Domain Path: The domain path points to a folder that does not exist ("/lang/")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin40,738 lines of code in 212 files:
LanguageFilesBlank linesComment linesLines of code
PHP1869,31320,89840,305
Markdown2680216
JavaScript93487202
CSS1501015

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity55.78
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.16
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces3
Traits0
Classes95
▷ Abstract classes55.26%
▷ Concrete classes9094.74%
▷ Final classes1011.11%
Methods1,760
▷ Static methods23313.24%
▷ Public methods1,27972.67%
▷ Protected methods844.77%
▷ Private methods39722.56%
Functions129
▷ Named functions11589.15%
▷ Anonymous functions1410.85%
Constants184
▷ Global constants10154.89%
▷ Class constants8345.11%
▷ Public constants83100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
assets/img/icon.png18.28KB9.41KB▼ 48.49%
lib/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%