94% acf-role-selector-field

Code Review | ACF: User Role Selector

WordPress plugin ACF: User Role Selector scored 94% 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: 5.9.2
  • 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

1,000+ active / 6,125 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

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

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

A check of server-side resources used by ACF: User Role Selector
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0152.76 ▲3.71
Dashboard /wp-admin3.42 ▲0.0135.60 ▲1.46
Posts /wp-admin/edit.php3.65 ▲0.0138.31 ▼6.42
Add New Post /wp-admin/post-new.php6.89 ▼0.08102.33 ▼1,256.14
Media Library /wp-admin/upload.php3.30 ▲0.0131.98 ▲3.51

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 9 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for ACF: User Role Selector
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,763 ▲1015.98 ▲0.155.86 ▼1.212.27 ▼0.54
Dashboard /wp-admin2,892 ▲386.15 ▼0.05114.97 ▼25.24157.51 ▼5.79
Posts /wp-admin/edit.php2,670 ▼213.24 ▲0.0064.25 ▲2.82153.35 ▲4.26
Add New Post /wp-admin/post-new.php1,773 ▲10721.18 ▲0.81481.29 ▲62.16161.88 ▼14.14
Media Library /wp-admin/upload.php1,698 ▲35.51 ▼0.00149.83 ▼7.26189.74 ▼12.27

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not 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 fix the following items
  • 3× GET requests to PHP files have triggered server-side errors or warnings:
    • > 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
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/acf-role-selector-field/acf-role_selector-v4.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
2 plugin tags: acf, custom fields

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
The following require your attention:
  • Main file name: Name the main plugin file the same as 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 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
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

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued 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 images were found in this plugin