impress-org / givewp

GiveWP - The #1 Donation Plugin for WordPress. Easily accept donations and fundraise using your WordPress website.
https://givewp.com/
GNU General Public License v3.0
345 stars 191 forks source link

fix: Reports should support WordPress 4.8+ #4848

Closed lindseymacmillan closed 2 years ago

lindseymacmillan commented 4 years ago

Bug Report

User Story

As a user, I want the Reports feature to support WordPress version 4.8+ so that I do not have to update WP core to install GiveWP.

Details

A sizable percentage of WP users are still running WP 4.8 and 4.9, and GiveWP should continue to fully support these users. Currently, all aspects of GiveWP work as expected on a 4.8 or 4.9 install, except for the Reports feature.

Current Behavior

When running GiveWP on WordPress 4.8 or 4.9, the Reports page is in not functional and produces the following error:

Fatal error: Uncaught Error: Call to undefined function Give\Views\Admin\Pages\wp_set_script_translations() in /Users/steward/Local Sites/localgive/app/public/wp-content/plugins/give/src/Views/Admin/Pages/Reports.php on line 65
( ! ) Error: Call to undefined function Give\Views\Admin\Pages\wp_set_script_translations() in /Users/steward/Local Sites/localgive/app/public/wp-content/plugins/give/src/Views/Admin/Pages/Reports.php on line 65
Call Stack
#   Time    Memory  Function    Location
1   0.0001  412152  {main}( )   .../edit.php:0
2   0.0001  413400  require_once( '/Users/steward/Local Sites/localgive/app/public/wp-admin/admin.php' )    .../edit.php:10
3   0.7694  4933344 require_once( '/Users/steward/Local Sites/localgive/app/public/wp-admin/admin-header.php' ) .../admin.php:216
4   0.7703  4941360 do_action( )    .../admin-header.php:97
5   0.7703  4941736 WP_Hook->do_action( )   .../plugin.php:453
6   0.7703  4941736 WP_Hook->apply_filters( )   .../class-wp-hook.php:310
7   0.7708  4945112 Give\Views\Admin\Pages\Reports->enqueue_scripts( )  .../class-wp-hook.php:286

Expected Behavior

GiveWP should fully support WP Core 4.8+. The Reports feature should function correctly, and display/function the same in all releases of WP 4.8+.

The Reports page should not produce any PHP errors.

Bug Type

Steps to Reproduce

  1. on a local site, open the shell and wp core download --version="4.9.13" --force
  2. Navigate to the reports page.

Possible Solution

Back-port in wp_set_script_translations for those running WordPress under 5.0.

Acceptance Criteria

jonwaldstein commented 2 years ago

Closing this since WP version is now at 5.9+ and reports are working properly.