78% bp-restrict

Code Review | Restrictions for BuddyPress

WordPress plugin Restrictions for BuddyPress scored78%from 54 tests.

About plugin

  • Plugin page: bp-restrict
  • Plugin version: 1.5.2
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.9.0
  • WordPress version: 6.3.1
  • First release: Jun 4, 2018
  • Latest release: Feb 6, 2022
  • Number of updates: 22
  • Update frequency: every 64.7 days
  • Top authors: seventhqueen (90.91%)staxwp (13.64%)

Code review

54 tests

User reviews

4 reviews

Install metrics

700+ active /15,291 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲1.83MB] [CPU: ▲10.17ms] Passed 4 tests

A check of server-side resources used by Restrictions for BuddyPress
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0839.67 ▼4.57
Dashboard /wp-admin5.73 ▲2.3871.52 ▲0.48
Posts /wp-admin/edit.php5.84 ▲2.4875.34 ▲25.16
Add New Post /wp-admin/post-new.php8.33 ▲2.44124.48 ▲19.62
Media Library /wp-admin/upload.php5.65 ▲2.4269.21 ▲31.21
Redux /wp-admin/options-general.php?page=redux-framework5.6659.76
BuddyPress Restrict /wp-admin/options-general.php?page=bp-restrict5.8262.73

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 773 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
widget_recent-posts
db_upgraded
can_compress_scripts
theysaidso_admin_options
bp_restrict_opt-transients
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Restrictions for BuddyPress
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,797 ▲3614.28 ▲0.011.86 ▲0.0142.08 ▼2.55
Dashboard /wp-admin2,203 ▲355.59 ▼0.1093.21 ▼6.9441.13 ▼3.97
Posts /wp-admin/edit.php2,116 ▲192.02 ▲0.0441.63 ▲4.4835.50 ▼0.14
Add New Post /wp-admin/post-new.php1,537 ▲223.04 ▲4.80630.27 ▼65.8353.94 ▼14.03
Media Library /wp-admin/upload.php1,413 ▲194.15 ▼0.10105.80 ▲7.2643.38 ▼1.46
Redux /wp-admin/options-general.php?page=redux-framework1,0733.6584.4992.92
BuddyPress Restrict /wp-admin/options-general.php?page=bp-restrict1,2042.6058.95223.90

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 7 options
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • bp_restrict_opt-transients
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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 take a closer look at the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/bp-restrict/public/views/public.php
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/bp-restrict/includes/options/templates/panel/menu-container.tpl.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/bp-restrict/includes/options/templates/panel/header.tpl.php:11
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/bp-restrict/includes/options/templates/panel/container.tpl.php:11
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/bp-restrict/includes/options/templates/panel/content.tpl.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/bp-restrict/includes/options/templates/panel/header-stickybar.tpl.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/bp-restrict/admin/views/admin.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: bp restrictions, buddypress, buddypress restrictions, pmpro, restrict...

bp-restrict/bp-restrict.php Passed 13 tests

"Restrictions for BuddyPress" version 1.5.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
36 characters long description:
Restrict BuddyPress pages or content

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected63,547 lines of code in 463 files:
LanguageFilesBlank linesComment linesLines of code
PHP1576,59111,84724,873
JavaScript1175,2452,75621,356
Sass871,7598712,057
CSS893,4232743,497
SVG107711,720
Markdown310044

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 110)
Cyclomatic complexity
Average complexity per logical line of code0.58
Average class complexity34.87
▷ Minimum class complexity1.00
▷ Maximum class complexity338.00
Average method complexity5.63
▷ Minimum method complexity1.00
▷ Maximum method complexity110.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes148
▷ Abstract classes42.70%
▷ Concrete classes14497.30%
▷ Final classes00.00%
Methods1,087
▷ Static methods28926.59%
▷ Public methods83476.72%
▷ Protected methods14112.97%
▷ Private methods11210.30%
Functions18
▷ Named functions1372.22%
▷ Anonymous functions527.78%
Constants100
▷ Global constants22.00%
▷ Class constants9898.00%
▷ Public constants98100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
61 PNG files occupy 0.58MB with 0.17MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/banner-772x250.png11.50KB5.06KB▼ 56.00%
includes/options/assets/img/raw/jquery-ui-bootstrap/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
includes/options/assets/img/jquery-ui-bootstrap/ui-icons_2e83ff_256x240.png4.10KB4.11KB0.00%
includes/options/assets/img/jquery-ui-bootstrap/ui-bg_glass_75_e6e6e6_1x400.png0.11KB0.14KB0.00%
includes/options/assets/img/raw/2-col-portfolio.png1.02KB0.15KB▼ 85.07%