84% only-for-registered-users

Code Review | Only for Registered Users

WordPress plugin Only for Registered Users scored84%from 54 tests.

About plugin

  • Plugin page: only-for-register...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-3.9.1
  • WordPress version: 6.3.1
  • First release: Jul 29, 2014
  • Latest release: Sep 2, 2014
  • Number of updates: 4
  • Update frequency: every 8.8 days
  • Top authors: sunnyverma1984 (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

200+ active /10,888 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
This plugin's installer ran successfully

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

A check of server-side resources used by Only for Registered Users
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0135.43 ▼5.25
Dashboard /wp-admin3.31 ▲0.0146.33 ▼2.71
Posts /wp-admin/edit.php3.36 ▲0.0144.44 ▼2.73
Add New Post /wp-admin/post-new.php5.90 ▲0.0289.49 ▼8.39
Media Library /wp-admin/upload.php3.23 ▲0.0132.70 ▼1.16

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 8 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Only for Registered Users
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.22 ▼1.181.64 ▼0.1743.17 ▲0.97
Dashboard /wp-admin2,206 ▲184.85 ▼0.22112.23 ▼3.7641.73 ▼3.75
Posts /wp-admin/edit.php2,095 ▲92.00 ▼0.0239.01 ▲1.7533.79 ▼0.66
Add New Post /wp-admin/post-new.php6,247 ▲4,72821.69 ▼1.35866.06 ▲176.5665.29 ▲0.42
Media Library /wp-admin/upload.php1,388 ▲34.31 ▲0.1096.34 ▼19.2143.21 ▼4.94

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 75% 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 50% 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 take a closer look at the following
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/only-for-registered-users/post_meta_box.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/only-for-registered-users/only-for-registered-users.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
The official readme.txt is a good inspiration

only-for-registered-users/only-for-registered-users.php Passed 13 tests

"Only for Registered Users" version 1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
67 characters long description:
Make post, page or partial content visible to registered users only

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin144 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP22852102
PO File15729
JavaScript15613

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity11.00
▷ Minimum class complexity11.00
▷ Maximum class complexity11.00
Average method complexity3.50
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
js/regUserOnly.png0.93KB0.73KB▼ 21.20%