-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transfer Verbum app into into jetpack-mu-wpcom #34993
Changes from all commits
40dc407
67760a1
88a257d
39570ea
b88da1c
b9bbdf3
0e1f43e
43a797f
d25ddb9
69afbe1
4833d6e
2117c38
be415c4
7a09ecc
1295e09
ca23f49
bcf2447
a696fca
d955ab6
5ac3a48
2cc6f0e
460cc92
e31d9a1
78885b2
63cf770
aa641ee
f99c93c
10f2507
9dc3f0e
ba2dd2e
a11f3e9
015c073
6c66b5d
e445ed7
9d197fd
43a064d
692cad2
6d9dbe3
aab85be
6bb491c
05c883f
4fa8476
898f921
4ce269a
7074f28
355ebdf
925423c
d9178e7
557dbc7
c0aed72
0af3b26
c64dc3c
70551b8
69dd842
8f0e01f
f0eedd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
Add Verbum Comments in jetpack-mu-wpcom plugin |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
* Jetpack_Mu_Wpcom main class. | ||
*/ | ||
class Jetpack_Mu_Wpcom { | ||
const PACKAGE_VERSION = '5.9.0'; | ||
const PACKAGE_VERSION = '5.10.0-alpha'; | ||
const PKG_DIR = __DIR__ . '/../'; | ||
const BASE_DIR = __DIR__ . '/'; | ||
const BASE_FILE = __FILE__; | ||
|
@@ -42,6 +42,8 @@ public static function init() { | |
|
||
add_action( 'plugins_loaded', array( __CLASS__, 'load_first_posts_stream_helpers' ) ); | ||
|
||
add_action( 'plugins_loaded', array( __CLASS__, 'load_verbum_comments' ) ); | ||
|
||
// Unified navigation fix for changes in WordPress 6.2. | ||
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'unbind_focusout_on_wp_admin_bar_menu_toggle' ) ); | ||
|
||
|
@@ -218,4 +220,42 @@ public static function load_marketplace_products_updater() { | |
public static function load_first_posts_stream_helpers() { | ||
require_once __DIR__ . '/features/first-posts-stream/first-posts-stream-helpers.php'; | ||
} | ||
|
||
/** | ||
* Determine whether to disable the comment experience. | ||
* | ||
* @param int $blog_id The blog ID. | ||
* @return boolean | ||
*/ | ||
private function should_disable_comment_experience( $blog_id ) { | ||
require_once WP_CONTENT_DIR . '/lib/wpforteams/functions.php'; | ||
// This covers both P2 and P2020 themes. | ||
$is_p2 = str_contains( get_stylesheet(), 'pub/p2' ) || function_exists( '\WPForTeams\is_wpforteams_site' ) && is_wpforteams_site( $blog_id ); | ||
$is_forums = str_contains( get_stylesheet(), 'a8c/supportforums' ); // Not in /forums | ||
|
||
// Don't load any comment experience in the Reader, GlotPress, wp-admin, or P2. | ||
return ( 1 === $blog_id || TRANSLATE_BLOG_ID === $blog_id || is_admin() || $is_p2 || $is_forums ); | ||
} | ||
|
||
/** | ||
* Load Verbum Comments. | ||
*/ | ||
public static function load_verbum_comments() { | ||
if ( class_exists( 'Verbum_Comments' ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. class_exists condition will be removed when this is finalized, merged into WPCOM, removed from mu-plugins/verbum and we're ready to transfer over to Verbum_Comments inside of jetpack-mu-wpcom plugin. |
||
return; | ||
} else { | ||
$blog_id = get_current_blog_id(); | ||
// Jetpack loads Verbum though an iframe from jetpack.wordpress.com. | ||
// So we need to check the GET request for the blogid. | ||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
if ( isset( $_GET['blogid'] ) ) { | ||
$blog_id = intval( $_GET['blogid'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
} | ||
if ( should_disable_comment_experience( $blog_id ) ) { | ||
return false; | ||
} | ||
require_once __DIR__ . '/build/verbum-comments/class-verbum-comments.php'; | ||
new \Automattic\Jetpack\Verbum_Comments(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought: this is going to fail on Atomic sites, as this code only exists on WordPress.com Simple. Or did we already verify that it will work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it did fail on Atomic sites, leading to the revert in #35194. The second attempt at this in #35196 (specifically e89db35) both added a check before the require and added a check to only register the action that calls this method on Simple.