adventistchurch / alps-wordpress

This Wordpress theme is an implementation of the Adventist Living Pattern System (ALPS) designed to support the work of the Seventh-day Adventist Church.
Other
43 stars 38 forks source link

Error with Carbon Fields and ALPS 3.15 #759

Open designerbrent opened 2 months ago

designerbrent commented 2 months ago

Version of ALPS for Wordpress WordPress version 6.5.2 Active theme: ALPS for WordPress (version 3.15.2.3) PHP version 8.2.18

Describe the bug After upgrading from a very old version of the ALPS for Wordpress theme, I started getting regular errors emailed to me each night.

An error of type E_ERROR was caused in line 277 of the file .../wp-content/themes/alps-wordpress-v3/app/carbon-fields/cf-theme-options.php](http://old.callaim.org/adventistinfo.org/wp-content/themes/alps-wordpress-v3/app/carbon-fields/cf-theme-options.php). Error message: Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in .../wp-content/themes/alps-wordpress-v3/app/carbon-fields/cf-theme-options.php:277](http://old.callaim.org/adventistinfo.org/wp-content/themes/alps-wordpress-v3/app/carbon-fields/cf-theme-options.php:277)
Stack trace:
#0 .../wp-content/themes/alps-wordpress-v3/app/carbon-fields/cf-theme-options.php](http://old.callaim.org/adventistinfo.org/wp-content/themes/alps-wordpress-v3/app/carbon-fields/cf-theme-options.php)(277): fread()
#1 .../wp-includes/class-wp-hook.php](http://old.callaim.org/adventistinfo.org/wp-includes/class-wp-hook.php)(324): crb_attach_theme_options()
#2 .../wp-includes/class-wp-hook.php](http://old.callaim.org/adventistinfo.org/wp-includes/class-wp-hook.php)(348): WP_Hook->apply_filters()
#3 .../wp-includes/plugin.php](http://old.callaim.org/adventistinfo.org/wp-includes/plugin.php)(517): WP_Hook->do_action()
#4 .../wp-content/themes/alps-wordpress-v3/vendor/htmlburger/carbon-fields/core/Loader/Loader.php](http://old.callaim.org/adventistinfo.org/wp-content/themes/alps-wordpress-v3/vendor/htmlburger/carbon-fields/core/Loader/Loader.php)(113): do_action()
#5 .../wp-includes/class-wp-hook.php](http://old.callaim.org/adventistinfo.org/wp-includes/class-wp-hook.php)(324): Carbon_Fields\Loader\Loader->trigger_fields_register()
#6 .../wp-includes/class-wp-hook.php](http://old.callaim.org/adventistinfo.org/wp-includes/class-wp-hook.php)(348): WP_Hook->apply_filters()
#7 .../wp-includes/plugin.php](http://old.callaim.org/adventistinfo.org/wp-includes/plugin.php)(517): WP_Hook->do_action()
#8 .../wp-settings.php](http://old.callaim.org/adventistinfo.org/wp-settings.php)(695): do_action()
#9 .../wp-config.php](http://old.callaim.org/adventistinfo.org/wp-config.php)(188): require_once('...')
#10 .../wp-load.php](http://old.callaim.org/adventistinfo.org/wp-load.php)(50): require_once('...')
#11 .../wp-login.php](http://old.callaim.org/adventistinfo.org/wp-login.php)(12): require('...')
#12 {main}
designerbrent commented 1 month ago

Anyone else seeing this issue/error? @johnrbeckett @YauheniKapliarchuk @hans-olson

claytonk commented 1 month ago

@designerbrent That error would indicate the theme.json file returned a 0 length, either because it's missing or because get_template_directory() returned an incorrect path. Since this is an error generated by changes I made I'll have a look at it today to see if I can reproduce it and get a patch in place.

claytonk commented 1 month ago

@designerbrent Do you know what version you were upgrading from? I'm not able to reproduce this here. Are you able to change color themes successfully on this site? Does the selected color palette show up in your block editor?

The function of the portion of the code producing the error is to read the existing theme.json file (which should be in the root directory of your theme), to parse the included colors.json file, and to write the selected color palette to the theme.json file so the palette is accessible in the block editor. This error indicates the theme.json file is either empty, missing, or inaccessible in some way. Maybe a file permissions issue?

designerbrent commented 1 month ago

I'm not sure what version I upgraded from. It was fairly old and before the new/current deploy system.

In changing the theme color the home page white screened, but only for logged in users. I finally tweaked WP Rocket and got that to load.

The theme colors do show in the block editor, so that is working now, though the block editor has no style to it and the fonts are all Times New Roman or similar. Is that expected?

@claytonk

claytonk commented 1 month ago

@designerbrent Not sure what you're seeing, but the fonts in the editor do show up as default serif. The editor stylesheet needs some work, it overrides in some places where it shouldn't and doesn't in places it should. However, the styling related to structure should be working.

Are you still getting that PHP error?

designerbrent commented 1 month ago

The page editor looks like the attached image for us. The colors do show (That is a nice touch that I didn't realize was available) and it is generally quite a jump between what shows on the page editor and what it actually looks like when you view the page.

I haven't seen any PHP errors in a couple days.

Untitled

YauheniKapliarchuk commented 1 month ago

@designerbrent I am going to check this issue, of course this is not so nice.

claytonk commented 1 month ago

@designerbrent Yeah, that's the ALPS blocks plugin, it doesn't render as actual blocks in the editor. I wasn't in on the development of that plugin so I can't speak to it, but my understanding is it's sort of a hybrid, not a full gutenberg setup, so that is what you get in the editor. When you use a full page builder plugin like Spectra, Stackable, or Toolset you should get rendered blocks like this.

image
designerbrent commented 1 month ago

@claytonk I've been playing with some other WP themes that are fully block themes and they look very close to the actual front page in the editor, which is nice. I know when we started working on this theme, that wasn't an option, but it would be nice to get this closer to that.

claytonk commented 1 month ago

Yep. Unfortunately it doesn't look like there's much of a bridge from here to there, it's more like a start-from-scratch proposition.