84% hide-admin-bar-based-on-user-roles

Code Review | Hide Admin Bar Based on User Roles

WordPress plugin Hide Admin Bar Based on User Roles scored84%from 54 tests.

About plugin

  • Plugin page: hide-admin-bar-ba...
  • Plugin version: 3.6.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Jul 16, 2018
  • Latest release: Nov 9, 2023
  • Number of updates: 88
  • Update frequency: every 22.1 days
  • Top authors: ankitmaru (100%)

Code review

54 tests

User reviews

18 reviews

Install metrics

30,000+ active /365,356 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.09MB] [CPU: ▼5.19ms] Passed 4 tests

A check of server-side resources used by Hide Admin Bar Based on User Roles
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.1036.97 ▼3.52
Dashboard /wp-admin3.39 ▲0.0945.13 ▼6.42
Posts /wp-admin/edit.php3.51 ▲0.1544.89 ▼1.45
Add New Post /wp-admin/post-new.php5.98 ▲0.0981.45 ▼9.38
Media Library /wp-admin/upload.php3.32 ▲0.0935.73 ▲2.75
Hide Admin Bar Settings /wp-admin/options-general.php?page=hide-admin-bar-settings3.2932.04

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 156 new files
Database: no new tables, 8 new options
New WordPress options
can_compress_scripts
hab_reset_key
db_upgraded
widget_theysaidso_widget
hab_settings
theysaidso_admin_options
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Hide Admin Bar Based on User Roles
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,902 ▲14013.27 ▼1.087.97 ▲6.1640.16 ▼4.69
Dashboard /wp-admin2,199 ▲245.50 ▼0.0982.34 ▼20.0435.97 ▼2.34
Posts /wp-admin/edit.php2,104 ▲41.98 ▼0.0335.43 ▼4.4033.10 ▼5.82
Add New Post /wp-admin/post-new.php1,529 ▲323.41 ▲0.12654.54 ▲40.2847.67 ▼5.25
Media Library /wp-admin/upload.php1,401 ▲14.21 ▲0.0496.30 ▼2.3340.23 ▼1.88
Hide Admin Bar Settings /wp-admin/options-general.php?page=hide-admin-bar-settings1,2992.2857.6672.60

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • hab_settings
    • widget_recent-posts
    • db_upgraded

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
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/hide-admin-bar-based-on-user-roles/public/partials/hide-admin-bar-based-on-user-roles-public-display.php
    • > /wp-content/plugins/hide-admin-bar-based-on-user-roles/admin/partials/hide-admin-bar-based-on-user-roles-admin-display.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: admin bar hide, hide admin bar, admin bar, hide admin bar based on user roles, admin bar hide based on user roles...

hide-admin-bar-based-on-user-roles/hide-admin-bar-based-on-user-roles.php Passed 13 tests

The main PHP script in "Hide Admin Bar Based on User Roles" version 3.6.2 is automatically included on every request by WordPress
96 characters long description:
This plugin is very useful to hide admin bar based on selected user roles and user capabilities.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin23,305 lines of code in 76 files:
LanguageFilesBlank linesComment linesLines of code
CSS531,93452622,396
PHP12160544387
XML400358
JavaScript674499
PO File1212365

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity6.43
▷ Minimum class complexity1.00
▷ Maximum class complexity23.00
Average method complexity2.36
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods28
▷ Static methods27.14%
▷ Public methods2382.14%
▷ Protected methods00.00%
▷ Private methods517.86%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
68 PNG files occupy 0.21MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/css/square/square@2x.png4.37KB3.09KB▼ 29.43%
admin/css/square/yellow@2x.png4.28KB3.07KB▼ 28.23%
admin/css/flat/aero.png1.48KB1.66KB0.00%
admin/css/minimal/purple.png1.11KB1.45KB0.00%
admin/css/square/purple@2x.png4.40KB3.06KB▼ 30.39%