84% hide-posts-for-specific-roles

Code Review | Hide posts for specific roles

WordPress plugin Hide posts for specific roles scored84%from 54 tests.

About plugin

  • Plugin page: hide-posts-for-sp...
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.3.2
  • WordPress version: 6.3.1
  • First release: Nov 9, 2016
  • Latest release: Jan 21, 2020
  • Number of updates: 3
  • Update frequency: every 388.3 days
  • Top authors: marcelotorres (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /1,283 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼2.79ms] Passed 4 tests

This is a short check of server-side resources used by Hide posts for specific roles
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0543.46 ▲3.88
Dashboard /wp-admin3.36 ▲0.0149.81 ▼13.11
Posts /wp-admin/edit.php3.41 ▲0.0547.46 ▼5.15
Add New Post /wp-admin/post-new.php5.94 ▲0.0599.40 ▲5.41
Media Library /wp-admin/upload.php3.28 ▲0.0536.96 ▲3.21
Hide posts /wp-admin/tools.php?page=hpfsr-settings3.2333.70

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 11 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Hide posts for specific roles
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲4714.21 ▼0.031.82 ▲0.1747.04 ▲3.07
Dashboard /wp-admin2,199 ▲255.62 ▼0.0390.35 ▲0.7740.49 ▼0.56
Posts /wp-admin/edit.php2,104 ▲42.03 ▼0.0037.20 ▼4.6333.58 ▼6.18
Add New Post /wp-admin/post-new.php1,529 ▼623.59 ▲5.29680.53 ▲5.9757.13 ▼11.32
Media Library /wp-admin/upload.php1,404 ▲44.29 ▲0.09122.27 ▲15.3054.89 ▲5.54
Hide posts /wp-admin/tools.php?page=hpfsr-settings1,0692.0547.0238.26

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
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These server-side errors were triggered
  • 15 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=hpfsr-settings
    • > Notice in wp-content/plugins/hide-posts-for-specific-roles/classes/class-hide-posts-for-specific-roles.php+135
    Undefined index: post_status
    • > GET request to /wp-admin/tools.php?page=hpfsr-settings
    • > Notice in wp-content/plugins/hide-posts-for-specific-roles/classes/class-hide-posts-for-specific-roles.php+279
    Undefined index:
    • > GET request to /wp-admin/tools.php?page=hpfsr-settings
    • > Notice in wp-content/plugins/hide-posts-for-specific-roles/classes/class-hide-posts-for-specific-roles.php+279
    Trying to get property 'label' of non-object
    • > GET request to /wp-admin/tools.php?page=hpfsr-settings
    • > Notice in wp-content/plugins/hide-posts-for-specific-roles/classes/class-hide-posts-for-specific-roles.php+299
    Undefined index: edit_posts

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (Plugin setting page), #2 (Plugin setting page, media view)
Please take inspiration from this readme.txt

hide-posts-for-specific-roles/hide-posts-for-specific-roles.php 92% from 13 tests

The entry point to "Hide posts for specific roles" version 1.1.0 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

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 plugin326 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP352131207
JavaScript1151354
PO File16738253
CSS15012

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity33.00
▷ Minimum class complexity33.00
▷ Maximum class complexity33.00
Average method complexity3.91
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods11
▷ Static methods545.45%
▷ Public methods654.55%
▷ Protected methods00.00%
▷ Private methods545.45%
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

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 compressed PNG files occupy 0.04MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png20.05KB20.53KB0.00%
screenshot-1.png19.22KB19.41KB0.00%