74% hide-dashboard-for-roles

Code Review | Hide Dashboard for Roles

WordPress plugin Hide Dashboard for Roles scored74%from 54 tests.

About plugin

  • Plugin page: hide-dashboard-fo...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-5.0
  • WordPress version: 6.3.1
  • First release: Nov 12, 2018
  • Latest release: Dec 11, 2018
  • Number of updates: 3
  • Update frequency: every 10.0 days
  • Top authors: renemanqueros (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /549 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.91MB] [CPU: ▼29.32ms] Passed 4 tests

Analyzing server-side resources used by Hide Dashboard for Roles
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.03 ▼4.91
Dashboard /wp-admin3.03 ▼0.2723.55 ▼22.60
Posts /wp-admin/edit.php3.04 ▼0.3223.48 ▼22.05
Add New Post /wp-admin/post-new.php3.03 ▼2.8524.27 ▼59.57
Media Library /wp-admin/upload.php3.04 ▼0.1923.51 ▼13.05

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Hide Dashboard for Roles
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲4014.26 ▼0.051.67 ▼0.0338.14 ▼3.53
Dashboard /wp-admin2,207 ▲305.56 ▼0.1383.68 ▼2.4140.86 ▼0.54
Posts /wp-admin/edit.php2,112 ▲122.02 ▲0.0134.49 ▼6.6836.05 ▼0.72
Add New Post /wp-admin/post-new.php1,538 ▲1223.12 ▲0.16657.74 ▼55.7257.08 ▼10.40
Media Library /wp-admin/upload.php1,412 ▲124.17 ▼0.0397.65 ▼5.0746.98 ▲3.22

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/hide-dashboard-for-roles/index.php+44
    array_intersect(): Expected parameter 2 to be an array, bool given
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hide-dashboard-for-roles/index.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/hide-dashboard-for-roles/admin/settings.php:4
    • > PHP Notice
      Trying to get property 'roles' of non-object in wp-content/plugins/hide-dashboard-for-roles/admin/settings.php on line 3

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)
No browser errors were detected

Optimizations

Plugin configuration 93% 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
Please fix the following attributes:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === hide-dashboard-for-roles === )
You can look at the official readme.txt

hide-dashboard-for-roles/index.php 92% from 13 tests

The main file in "Hide Dashboard for Roles" v. 1.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("hide-dashboard-for-roles.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected84 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP2121184

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG images were found in this plugin