greencode
Forum Replies Created
-
Forum: Plugins
In reply to: [Backend Payments for WooCommerce] Not working after 2.8.7 update@bfl Appreciate the speedy fix. I can confirm, it’s working correctly now 🙂
Forum: Plugins
In reply to: [Delivery & Pickup Date Time for WooCommerce] Cannot use the plugin@cheesygoat Very strange. It worked for me. Hopefully @coderockz will get this issue resolved very soon.
Forum: Plugins
In reply to: [Delivery & Pickup Date Time for WooCommerce] Cannot use the plugin@cheesygoat What happens? Is it still just timing out?
Exactly the same. It seems to talk to their website. What I did was create a plugin that you add to plugins/mu-plugins/block-coderockz-http.php and add the following to that (and then activate this plugin first and then activate the delivery date plugin after). This then blocks the plugin from talking to their website. Not ideal but at least the plugin and your site will work until, hopefully, they are back up.
<?php
/*
Plugin Name: Block CodeRockz Remote Calls (temp)
Description: Short-circuits HTTP calls to coderockz.com to avoid admin slowdowns.
*/
add_filter('pre_http_request', function ($pre, $r, $url) {
if (strpos($url, 'coderockz.com') !== false) {
return new WP_Error('coderockz_blocked', 'Temporarily blocked CodeRockz remote request');
}
return $pre;
}, 10, 3);
// Keep all HTTP requests snappy while testing
add_filter('http_request_timeout', function () { return 3; });Forum: Plugins
In reply to: [Delivery & Pickup Date Time for WooCommerce] Cannot use the pluginExactly the same. It seems to talk to their website. What I did was create a plugin that you add to plugins/mu-plugins/block-coderockz-http.php and add the following to that (and then activate this plugin first and then activate the delivery date plugin after). This then blocks the plugin from talking to their website. Not ideal but at least the plugin and your site will work until, hopefully, they are back up.
<?php
/*
Plugin Name: Block CodeRockz Remote Calls (temp)
Description: Short-circuits HTTP calls to coderockz.com to avoid admin slowdowns.
*/
add_filter('pre_http_request', function ($pre, $r, $url) {
if (strpos($url, 'coderockz.com') !== false) {
return new WP_Error('coderockz_blocked', 'Temporarily blocked CodeRockz remote request');
}
return $pre;
}, 10, 3);
// Keep all HTTP requests snappy while testing
add_filter('http_request_timeout', function () { return 3; });Forum: Plugins
In reply to: [LiteSpeed Cache] Premmerce Permalink Manager Issues with LitespeedNot sure what you mean “yeah , it’s kind of wordpress core issue , it happens on sites that doesn’t have LiteSpeed” – My site does have Litespeed!
Forum: Plugins
In reply to: [LiteSpeed Cache] Premmerce Permalink Manager Issues with LitespeedBy updating Permalinks, without making any changes.
Forum: Plugins
In reply to: [LiteSpeed Cache] Premmerce Permalink Manager Issues with Litespeed@litetim Frustratingly it’s happening completely randomly. The report number is MVMRMIVG
Hi @janilyn409. I’ve tested with WooCommerce 9.8.5 and the latest version of your plugin 1.0.5 and everything appears to be working as it should. Thanks for resolving the issue. Very much appreciated.
Forum: Plugins
In reply to: [Friendly User Agent for WooCommerce] HPOS compatibility@windischweb @katmac_aus With the help of ChatGPT and Claude.ai I’ve managed to make this HPOS compatible. If you’re comfortable editing the plugin files then replace all of the content in the woo-friendly-user-agent.php file with this
<?php
/**
* Plugin Name: Friendly User Agent for WooCommerce
* Plugin URI:
* Description: Show the order user agent in a user friendly view on the orders page.
* Version: 1.4.0
* Tested up to: 6.5
* Requires PHP: 5.6
* WC requires at least: 3.0.0
* WC tested up to: 8.0.0
* Author: Blaze Concepts
* Author URI: https://www.blazeconcepts.co.uk/
*
* Text Domain: woo-friendly-user-agent
*
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Declare HPOS compatibility
*/
add_action( 'before_woocommerce_init', function() {
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
} );
/**
* Enable Languages
*
* @return void
*/
add_action( 'init', 'blz_fua_load_plugin_textdomain' );
function blz_fua_load_plugin_textdomain() {
$domain = 'woo-friendly-user-agent';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
}
include_once dirname( __FILE__ ) . '/parse-user-agent.php';
/**
* Add Friendly User Agent to single order page
*
* @param [object] $order
* @return void
*/
add_action( 'woocommerce_admin_order_data_after_billing_address', 'blz_fua_show_user_agent_admin_order' );
function blz_fua_show_user_agent_admin_order($order) {
$agent = $order->get_customer_user_agent();
if ( !isset($agent) || empty($agent) ) {
// Not set don't output
} else {
echo '<div class="single_order_ua"><strong>'.__('Customer User Agent','woo-friendly-user-agent').':</strong><br> '.blz_fua_getFriendlyAgent($agent).'</div>';
}
}
/**
* Add Friendly User Agent column to orders list page (legacy tables)
*
* @param [array] $columns
* @return $new_columns
*/
add_filter('manage_edit-shop_order_columns', 'blz_fua_add_order_agent_column_header', 20);
function blz_fua_add_order_agent_column_header( $columns ) {
$new_columns = array();
foreach ( $columns as $column_name => $column_info ) {
$new_columns[ $column_name ] = $column_info;
if ( 'order_total' === $column_name ) {
$new_columns['order_agent'] = __( 'User Agent', 'woo-friendly-user-agent' );
}
}
return $new_columns;
}
/**
* Add Friendly User Agent column to orders list page (HPOS)
*/
add_filter( 'woocommerce_shop_order_list_table_columns', 'blz_fua_add_order_agent_column_header_hpos', 20 );
function blz_fua_add_order_agent_column_header_hpos( $columns ) {
$new_columns = array();
foreach ( $columns as $column_name => $column_info ) {
$new_columns[ $column_name ] = $column_info;
if ( 'total' === $column_name ) {
$new_columns['order_agent'] = __( 'User Agent', 'woo-friendly-user-agent' );
}
}
return $new_columns;
}
/**
* Display Friendly User Agent in column on orders list page (legacy tables)
*
* @param [string] $column
* @return void
*/
add_action('manage_shop_order_posts_custom_column', 'blz_fua_add_order_agent_column_content');
function blz_fua_add_order_agent_column_content( $column ) {
global $post;
if ( 'order_agent' === $column ) {
$order = wc_get_order( $post->ID );
$agent = $order->get_customer_user_agent();
if ( !isset($agent) || empty($agent) ) {
$output = __('Not set','woo-friendly-user-agent');
} else {
$output = blz_fua_getFriendlyAgent($agent);
}
echo $output;
}
}
/**
* Display Friendly User Agent in column on orders list page (HPOS)
*/
add_action( 'manage_woocommerce_page_wc-orders_custom_column', 'blz_fua_add_order_agent_column_content_hpos', 10, 2 );
function blz_fua_add_order_agent_column_content_hpos( $column, $order ) {
if ( 'order_agent' === $column ) {
$agent = $order->get_customer_user_agent();
if ( !isset($agent) || empty($agent) ) {
$output = __('Not set','woo-friendly-user-agent');
} else {
$output = blz_fua_getFriendlyAgent($agent);
}
echo $output;
}
}
/**
* Get Friendly User Agent and return output
*
* @param [string] $agent
* @return $output
*/
function blz_fua_getFriendlyAgent($agent) {
$friendlyagent = blz_fua_parse_user_agent($agent);
$output = '';
if(isset($friendlyagent['platform']) && !empty($friendlyagent['platform'])){
$output .= __('Platform','woo-friendly-user-agent').': '.$friendlyagent['platform'];
} else {
$output .= __('Platform: Not known','woo-friendly-user-agent');
}
if(isset($friendlyagent['imgplatform']) && !empty($friendlyagent['imgplatform'])){
$output .= '<img src="'.$friendlyagent['imgplatform'].'" width="15" height="15" />';
}
$output .= '<br>';
if(isset($friendlyagent['browser']) && !empty($friendlyagent['browser'])){
$output .= __('Browser','woo-friendly-user-agent').': '.$friendlyagent['browser'];
} else {
$output .= __('Browser: Not known','woo-friendly-user-agent');
}
if(isset($friendlyagent['imgbrowser']) && !empty($friendlyagent['imgbrowser'])){
$output .= '<img src="'.$friendlyagent['imgbrowser'].'" width="15" height="15" />';
}
$output .= '<br>';
if(isset($friendlyagent['version']) && !empty($friendlyagent['version'])){
$output .= __('Version','woo-friendly-user-agent').': '.$friendlyagent['version'];
}
return $output;
}
/**
* Add admin CSS
*
* @return void
*/
add_action( 'admin_print_styles', 'blz_fua_add_order_agent_column_style' );
function blz_fua_add_order_agent_column_style() {
$css = '.post-type-shop_order .wp-list-table td.column-order_agent,
.woocommerce-page.page-wc-orders .wp-list-table .order_agent.column-order_agent {
width: 9%;
line-height: 20px;
}
.post-type-shop_order .wp-list-table td.column-order_agent img,
.woocommerce-page.page-wc-orders .wp-list-table .order_agent.column-order_agent img {
vertical-align: middle;
margin-left: 5px;
}
.post-type-shop_order .single_order_ua,
.woocommerce-page.page-wc-orders .single_order_ua {
line-height: 20px;
}
.post-type-shop_order .single_order_ua img,
.woocommerce-page.page-wc-orders .single_order_ua img {
vertical-align: middle;
margin-left: 5px;
}';
wp_add_inline_style( 'woocommerce_admin_styles', $css );
}Basically added Added HPOS Compatibility Declaration
add_action( 'before_woocommerce_init', function() {
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
} );Added Support for HPOS Order List Columns
add_filter( 'woocommerce_shop_order_list_table_columns', 'blz_fua_add_order_agent_column_header_hpos', 20 );Added HPOS Order Column Content Handler
add_action( 'manage_woocommerce_page_wc-orders_custom_column', 'blz_fua_add_order_agent_column_content_hpos', 10, 2 );And Updated CSS for HPOS Compatibility (Added CSS selectors to target both traditional and HPOS order list views). Updated Version Number and WC Tested Up To (Increased version to 1.4.0 and updated WC tested up to 8.0.0)
Forum: Plugins
In reply to: [WooCommerce] Fatal error BlockPatterns.php:251Hi @lovingbro Thanks for this but it’s not just sites that disable the Legacy REST API plugin as other users are reporting i.e. some users are reporting the issue after making no updates or deactivating any plugins! I’ll keep an eye on the github you linked to.
Forum: Plugins
In reply to: [WooCommerce] Fatal errorIt’ll be the same as the other people that have reported this issue. See other posts in this support forum.
Forum: Plugins
In reply to: [WooCommerce] Fatal error BlockPatterns.php:251@mosesmedh Thanks for the quick update. Looking forward to a permanent resolution.
Forum: Plugins
In reply to: [WooCommerce] Fatal error BlockPatterns.php:251There’s a lot of people reporting it now on GitHub
Forum: Plugins
In reply to: [WooCommerce] Fatal error BlockPatterns.php:251Edit the code here
wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.phpReplace this
if ( strpos( $category['title'], $prefix ) !== false ) {with this
if ( isset( $category['title'] ) && is_string( $category['title'] ) && strpos( $category['title'], $prefix ) !== false ) {