84% acf-role-selector-field

Code Review | ACF: User Role Selector

WordPress plugin ACF: User Role Selector scored84%from 54 tests.

About plugin

  • Plugin page: acf-role-selector...
  • Plugin version: 3.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-4.2
  • WordPress version: 6.3.1
  • First release: Feb 2, 2014
  • Latest release: Apr 27, 2015
  • Number of updates: 16
  • Update frequency: every 28.1 days
  • Top authors: danielpataki (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

800+ active /7,391 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

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

This is a short check of server-side resources used by ACF: User Role Selector
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0138.83 ▼2.42
Dashboard /wp-admin3.32 ▲0.0149.71 ▼0.34
Posts /wp-admin/edit.php3.37 ▲0.0144.47 ▼4.24
Add New Post /wp-admin/post-new.php5.90 ▲0.0194.72 ▼7.02
Media Library /wp-admin/upload.php3.24 ▲0.0132.70 ▼2.86

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for ACF: User Role Selector
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6513.26 ▼1.041.80 ▲0.0144.85 ▲0.59
Dashboard /wp-admin2,209 ▲215.83 ▲0.97109.88 ▼6.5150.89 ▲5.17
Posts /wp-admin/edit.php2,089 ▼02.13 ▲0.1336.19 ▼5.9534.27 ▼2.56
Add New Post /wp-admin/post-new.php1,533 ▼023.14 ▲0.03659.50 ▼15.6759.04 ▼0.56
Media Library /wp-admin/upload.php1,391 ▲34.25 ▲0.11101.69 ▼21.5642.85 ▼6.45

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however 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
Please take a closer look at the following
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/acf-role-selector-field/acf-role_selector-v4.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/acf-role-selector-field/acf-role_selector-v5.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-role-selector-field/acf-role_selector.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
2 plugin tags: custom fields, acf

acf-role-selector-field/acf-role_selector.php 92% from 13 tests

"ACF: User Role Selector" version 3.0.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("acf-role-selector-field.php" instead of "acf-role_selector.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin302 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP370204253
PO File1161649

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity16.50
▷ Minimum class complexity16.00
▷ Maximum class complexity17.00
Average method complexity4.44
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods9
▷ Static methods00.00%
▷ Public methods9100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG files were detected