83% role-based-redirect

Code Review | Role Based Redirect

WordPress plugin Role Based Redirect scored83%from 54 tests.

About plugin

  • Plugin page: role-based-redirect
  • Plugin version: 1.5
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jul 20, 2018
  • Latest release: Jul 26, 2023
  • Number of updates: 16
  • Update frequency: every 114.6 days
  • Top authors: yasirkhalifa (100%)

Code review

54 tests

User reviews

14 reviews

Install metrics

2,000+ active /17,391 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼12.97ms] Passed 4 tests

Analyzing server-side resources used by Role Based Redirect
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0338.97 ▼9.08
Dashboard /wp-admin3.33 ▼0.0150.25 ▼12.69
Posts /wp-admin/edit.php3.38 ▲0.0347.81 ▼1.44
Add New Post /wp-admin/post-new.php5.91 ▲0.0382.39 ▼27.64
Media Library /wp-admin/upload.php3.26 ▲0.0337.13 ▼2.48

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 9 new files
Database: 1 new table, 6 new options
New tables
wp_rbrurls_redirect
New WordPress options
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

Role Based Redirect: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,811 ▲6513.56 ▼0.822.04 ▲0.3242.47 ▼0.57
Dashboard /wp-admin2,220 ▲325.86 ▲0.96106.53 ▼7.2670.42 ▲30.71
Posts /wp-admin/edit.php2,097 ▲82.05 ▲0.0438.30 ▼1.7633.66 ▼4.80
Add New Post /wp-admin/post-new.php1,529 ▲1523.15 ▲5.48702.36 ▲82.2252.46 ▲3.89
Media Library /wp-admin/upload.php1,399 ▲174.07 ▼0.1597.23 ▼0.3772.42 ▲30.75

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 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 does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
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
The following issues need your attention
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/role-based-redirect/includes/redirect.php

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)
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention:
  • Screenshots: Screenshot #1 (Admin page setting and layout) image not found
  • Requires at least: The plugin version is formatted incorrectly
The official readme.txt is a good inspiration

role-based-redirect/role-based-redirect.php Passed 13 tests

"Role Based Redirect" version 1.5's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
133 characters long description:
Redirect users to specific page after login, based on their the role and also option for hide adminbar and restrict dashboard access.

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 plugin321 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP2620310
CSS10011

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity18.00
▷ Minimum class complexity18.00
▷ Maximum class complexity18.00
Average method complexity3.12
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods8
▷ Static methods00.00%
▷ Public methods8100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
3 PNG files occupy 1.16MB with 0.70MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
banner-772x250.png1,165.14KB497.28KB▼ 57.32%
icon-128x128.png26.00KB15.22KB▼ 41.45%
images/icon.png1.02KB0.18KB▼ 81.95%