|
7 | 7 |
|
8 | 8 | namespace Activitypub\WP_Admin; |
9 | 9 |
|
| 10 | +use function Activitypub\site_supports_blocks; |
10 | 11 | use function Activitypub\user_can_activitypub; |
11 | 12 |
|
12 | 13 | /** |
@@ -35,16 +36,19 @@ public static function admin_menu() { |
35 | 36 | if ( user_can_activitypub( \get_current_user_id() ) ) { |
36 | 37 | $capability = ACTIVITYPUB_BLOG_MODE === \get_option( 'activitypub_actor_mode' ) ? 'manage_options' : 'activitypub'; |
37 | 38 |
|
38 | | - $social_web_hook = \add_dashboard_page( |
39 | | - \__( 'Social Web', 'activitypub' ), |
40 | | - \__( 'Social Web', 'activitypub' ), |
41 | | - $capability, |
42 | | - 'activitypub-social-web', |
43 | | - array( Social_Web::class, 'render_page' ) |
44 | | - ); |
| 39 | + // Check for block support and WP version. |
| 40 | + if ( site_supports_blocks() && \version_compare( \get_bloginfo( 'version' ), '6.9', '>=' ) ) { |
| 41 | + $app_hook = \add_dashboard_page( |
| 42 | + \__( 'Social Web', 'activitypub' ), |
| 43 | + \__( 'Social Web', 'activitypub' ), |
| 44 | + $capability, |
| 45 | + 'activitypub-social-web', |
| 46 | + array( Social_Web::class, 'render_page' ) |
| 47 | + ); |
45 | 48 |
|
46 | | - \add_action( 'load-' . $social_web_hook, array( Social_Web::class, 'remove_admin_notices' ) ); |
47 | | - \add_action( 'admin_print_scripts-' . $social_web_hook, array( Social_Web::class, 'enqueue_scripts' ) ); |
| 49 | + \add_action( 'load-' . $app_hook, array( Social_Web::class, 'remove_admin_notices' ) ); |
| 50 | + \add_action( 'admin_print_scripts-' . $app_hook, array( Social_Web::class, 'enqueue_scripts' ) ); |
| 51 | + } |
48 | 52 |
|
49 | 53 | $followers_list_page = \add_users_page( |
50 | 54 | \__( 'Followers ⁂', 'activitypub' ), |
|
0 commit comments