Open AmibeWebsites opened 1 month ago
same issue for me (v3.6.5) I try some patchs that seems to work, waiting for an official bugfix (not sure it cover all cases, but for basic snippet edition), seems ok
--- a/wp-content/plugins/code-snippets-pro/php/snippet-ops.php
+++ b/wp-content/plugins/code-snippets-pro/php/snippet-ops.php
@@ -230,11 +230,11 @@ function update_shared_network_snippets( array $snippets ): bool {
foreach ( $snippets as $snippet ) {
if ( $snippet->shared_network ) {
- if ( $snippet->active ) {
+ //if ( $snippet->active ) {
$shared_ids[] = $snippet->id;
} else {
$unshared_ids[] = $snippet->id;
- }
+ //}
}
}
add_filter("code_snippets/get_snippet", function($snippet, $id, $network) {
if ($network) {
$shared_network_snippets = get_site_option( 'shared_network_snippets', array() );
$snippet->shared_network = in_array( $snippet->fields['id'], $shared_network_snippets, true );
}
return $snippet;
}, 10, 3);
Prerequisites
Type of Bug
A Code Snippet
Description
In a multi-site, the option to 'Allow this snippet to be activated on individual sites on the network' does not save (and automatically disables the snippet on any individual site where it was activated for that site).
What I would expect is that the snippet would be available for activation on individual sites in that network, and that if it had previously already been active prior to saving the snippet, that it would remain active.
What happens is that the snippet is not made available to be activated on individual sites in the network, and if it had been activated for any individual site, it is now deactivated.
My work-around is to directly edit the 'shared_network_snippets' meta_key in the database for the network. And then I go and re-enable for all individual sites that use it.
Steps to reproduce
Steps to reproduce, in a multi-site setup, with multiple networks:
Isolating the problem
Comment