72% user-roles-and-capabilities

Code Review | User Roles and Capabilities

WordPress plugin User Roles and Capabilities scored 72% from 54 tests.

About plugin

  • Plugin page: user-roles-and-ca...
  • Plugin version: 1.2.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.7.1
  • WordPress version: 6.3.1
  • First release: Feb 3, 2015
  • Latest release: May 9, 2021
  • Number of updates: 26
  • Update frequency: every 88.0 days
  • Top authors: mahabub81 (100%)

Code review

54 tests

User reviews

20 reviews

Install metrics

10,000+ active / 113,344 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.31MB] [CPU: ▲3.22ms] Passed 4 tests

This is a short check of server-side resources used by User Roles and Capabilities
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.76 ▲0.2941.27 ▲4.36
Dashboard /wp-admin3.66 ▲0.3548.71 ▼2.58
Posts /wp-admin/edit.php3.71 ▲0.3555.10 ▲11.20
Add New Post /wp-admin/post-new.php6.20 ▲0.3196.79 ▲5.85
Media Library /wp-admin/upload.php3.52 ▲0.2836.35 ▲5.24
/wp-admin/admin.php?page=solvease-def3.4639.52
Roles & Capabilities /wp-admin/users.php?page=solvease-roles-capablities3.6135.49

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 65 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_recent-comments
solvease_wp_rc_caps
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for User Roles and Capabilities
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲3314.74 ▲0.001.68 ▼0.1541.78 ▼1.13
Dashboard /wp-admin2,210 ▲225.81 ▼0.04100.53 ▼6.5240.54 ▼0.61
Posts /wp-admin/edit.php2,096 ▲42.04 ▲0.0739.70 ▲3.3235.12 ▲3.62
Add New Post /wp-admin/post-new.php1,523 ▼1923.16 ▲5.06665.78 ▲47.5454.83 ▲1.65
Media Library /wp-admin/upload.php1,392 ▲44.17 ▼0.0097.85 ▼11.9047.73 ▲2.21
/wp-admin/admin.php?page=solvease-def7711.7626.2621.89
Roles & Capabilities /wp-admin/users.php?page=solvease-roles-capablities4,0932.2637.3264.70

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The uninstall procedure has failed, leaving 7 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • solvease_wp_rc_caps
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=solvease-def
    • > Notice in wp-content/plugins/user-roles-and-capabilities/includes/class-solvease-wp-roles-capabilities-table.php+29
    Undefined index: user

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 9× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/user-roles-and-capabilities/css/index.php
    • > /wp-content/plugins/user-roles-and-capabilities/includes/templates/table-end.tpl.php
    • > /wp-content/plugins/user-roles-and-capabilities/includes/templates/index.php
    • > /wp-content/plugins/user-roles-and-capabilities/fonts/index.php
    • > /wp-content/plugins/user-roles-and-capabilities/includes/templates/table-start.tpl.php
    • > /wp-content/plugins/user-roles-and-capabilities/includes/index.php
    • > /wp-content/plugins/user-roles-and-capabilities/js/index.php
    • > /wp-content/plugins/user-roles-and-capabilities/index.php
    • > /wp-content/plugins/user-roles-and-capabilities/images/index.php
  • 14× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/user-roles-and-capabilities/includes/templates/delete-role.tpl.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/user-roles-and-capabilities/includes/templates/user-caps-role.tpl.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/user-roles-and-capabilities/includes/templates/add-role.tpl.php:6
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/user-roles-and-capabilities/includes/templates/other-cap-rows.tpl.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/user-roles-and-capabilities/includes/templates/head-table.tpl.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/user-roles-and-capabilities/includes/templates/delete-cap.tpl.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/user-roles-and-capabilities/includes/templates/import-cap.tpl.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/user-roles-and-capabilities/includes/templates/default-role.tpl.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/user-roles-and-capabilities/includes/templates/export-cap.tpl.php:9
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/user-roles-and-capabilities/includes/templates/change-role-name.tpl.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (Add/edit roles, capabilities, change default roles, free support link etc), #2 (Go to specific users roles and capabilities.), #3 (Chnage user roles and capabilities.), #4 (Filter Capability), #5 (Add new role), #6 (Export Roles and Capabilities), #7 (Import Roles and Capabilities), #8 (Rename a role name)
You can look at the official readme.txt

user-roles-and-capabilities/user-roles-and-capabilities.php 92% from 13 tests

This is the main PHP file of "User Roles and Capabilities" version 1.2.6, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 216 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected12,898 lines of code in 37 files:
LanguageFilesBlank linesComment linesLines of code
CSS4165498,756
PHP252692882,231
JavaScript62233001,103
SVG200808

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity21.62
▷ Minimum class complexity1.00
▷ Maximum class complexity121.00
Average method complexity2.99
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods83
▷ Static methods56.02%
▷ Public methods4756.63%
▷ Protected methods00.00%
▷ Private methods3643.37%
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

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/adv.png1.06KB0.49KB▼ 54.23%
images/checkbutton.png0.48KB0.40KB▼ 17.58%
user-editor.png27.28KB13.14KB▼ 51.82%
images/sprite-radio.png1.47KB0.56KB▼ 61.58%