Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion includes/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class Options {
*/
private static $options = array();

/**
* The blog ID the cached options belong to.
*
* @var int $cache_blog_id
*/
private static $cache_blog_id = 0;

/**
* Get the options for Simple Comment Editing.
*
Expand All @@ -35,9 +42,21 @@ class Options {
*/
public static function get_options( $force = false, $key = '' ) {

// Per-site options are cached per blog, so switch_to_blog() cannot return stale values.
$blog_id = get_current_blog_id();
if ( self::$cache_blog_id !== $blog_id ) {
self::$options = array();
self::$cache_blog_id = $blog_id;
}

$options = self::$options;
if ( ! is_array( $options ) || empty( $options ) || true === $force ) {
$options = get_site_option( 'sce_options', array() );
// Read from the same place update_options() writes: network option only when network-activated.
if ( Functions::is_multisite() ) {
$options = get_site_option( 'sce_options', array() );
} else {
$options = get_option( 'sce_options', array() );
}
self::$options = $options;
}
if ( false === $options || empty( $options ) || ! is_array( $options ) ) {
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro
== Changelog ==

= Unreleased =
* Fix: On multisite, read settings from the same place they are saved, so sub-sites that are not network-activated use and display their own settings instead of defaults.
* Fix: Preserve WP ULike comment buttons, their vote state, and their top/bottom placement after inline comment saves.
* New: Add a repeat-safe, root-scoped initializer for AJAX/lazy-loaded comment controls and an opt-in guest ownership hook for validated AJAX submissions.
* New: Add moderator-only comment/subtree movement with a native admin preview, explicit confirmation, thread/count preservation, and recovery records.
Expand Down
Loading