Skip to content

Commit 5bbdcf3

Browse files
committed
General: Moved the banner on Jetpack Site to a below the connect
Updated display_jetpack_manage_notice to can_display_jetpack_manage_notice to be more clear. The non dismissible nag can now be found in opt_in_jetpack_manage_notice()
1 parent 0ef7165 commit 5bbdcf3

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

class.jetpack.php

+19-14
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ private function Jetpack() {
345345
* Check for and alert any deprecated hooks
346346
*/
347347
add_action( 'init', array( $this, 'deprecated_hooks' ) );
348-
// add_filter( 'display_jetpack_manage_notice', '__return_false' );
348+
// add_filter( 'can_display_jetpack_manage_notice', '__return_true' );
349349

350350
/*
351351
* Do things that should run even in the network admin
@@ -2367,7 +2367,7 @@ function admin_jetpack_manage_notice() {
23672367

23682368
// Only show it if don't have the managment option set.
23692369
// And not dismissed it already.
2370-
if ( ! $this->display_jetpack_manage_notice() || Jetpack_Options::get_option( 'dismissed_manage_banner' ) ) {
2370+
if ( ! $this->can_display_jetpack_manage_notice() || Jetpack_Options::get_option( 'dismissed_manage_banner' ) ) {
23712371
return;
23722372
}
23732373

@@ -2408,16 +2408,27 @@ function opt_out_jetpack_manage_url() {
24082408
function opt_in_jetpack_manage_url() {
24092409
return wp_nonce_url( Jetpack::admin_url( 'jetpack-notice=jetpack-manage-opt-in' ), 'jetpack_manage_banner_opt_in' );
24102410
}
2411+
2412+
function opt_in_jetpack_manage_notice() {
2413+
?>
2414+
<div class="wrap">
2415+
<div id="message" class="jetpack-message is-opt-in">
2416+
<?php echo sprintf( __( '<p>Your site isn\'t set up to allow management from WordPress.com yet. Learn more about <a href="%1$s">Site Management</a> or simply <a href="%2$s" title="Opt in to WordPress">opt-in</a>.</p> <a href="%2$s" class="jp-button">Opt in to site management</a>', 'jetpack' ), 'http://jetpack.me/support/site-management', $this->opt_in_jetpack_manage_url() ); ?>
2417+
</div>
2418+
</div>
2419+
<?php
2420+
2421+
}
24112422
/**
24122423
* Determines whether to show the notice of not true = display notice
24132424
* @return (bool)
24142425
*/
2415-
function display_jetpack_manage_notice() {
2426+
function can_display_jetpack_manage_notice() {
24162427
// never display the notice to users that can't do anything about it anyways
24172428
if( ! current_user_can( 'jetpack_manage_modules' ) )
24182429
return false;
24192430

2420-
return apply_filters( 'display_jetpack_manage_notice', ! Jetpack_Options::get_option( 'json_api_full_management' ) || ! self::is_module_active( 'json-api') );
2431+
return apply_filters( 'can_display_jetpack_manage_notice', ! Jetpack_Options::get_option( 'json_api_full_management' ) || ! self::is_module_active( 'json-api') );
24212432
}
24222433

24232434
function network_connect_notice() {
@@ -2907,7 +2918,7 @@ function admin_page_load() {
29072918

29082919
$this->privacy_checks = Jetpack::state( 'privacy_checks' );
29092920

2910-
if ( $this->message || $this->error || $this->privacy_checks || $this->display_jetpack_manage_notice() ) {
2921+
if ( $this->message || $this->error || $this->privacy_checks || $this->can_display_jetpack_manage_notice() ) {
29112922
add_action( 'jetpack_notices', array( $this, 'admin_notices' ) );
29122923
}
29132924

@@ -3010,15 +3021,9 @@ function admin_notices() {
30103021
</div>
30113022
<?php endif;
30123023
// only display the notice if the other stuff is not there
3013-
if( $this->display_jetpack_manage_notice() && ! $this->error && ! $this->message && ! $this->privacy_checks ) {
3014-
// @todo make this look nice
3015-
?>
3016-
<div class="wrap">
3017-
<div id="message" class="jetpack-message is-opt-in">
3018-
<?php printf( __( "Your site isn't set up to allow management from WordPress.com yet. Learn more about Site Management or simply <a href=\"%s\" title=\"Opt in to WordPress\">opt-in</a>.", 'jetpack' ), $this->opt_in_jetpack_manage_url() ); ?>
3019-
</div>
3020-
</div>
3021-
<?php
3024+
if( $this->can_display_jetpack_manage_notice() && ! $this->error && ! $this->message && ! $this->privacy_checks ) {
3025+
if( isset( $_GET['page'] ) && 'jetpack' != $_GET['page'] )
3026+
$this->opt_in_jetpack_manage_notice();
30223027
}
30233028
}
30243029

views/admin/admin-page.php

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<h2><?php _e('Jetpack is in local development mode.', 'jetpack' ); ?></h2>
3232
<?php elseif ( $data['is_connected'] ) : ?>
3333
<h2><?php _e("You're successfully connected to Jetpack!", 'jetpack' ); ?></h2>
34+
<?php
35+
if ( Jetpack::init()->can_display_jetpack_manage_notice() ) {
36+
Jetpack::init()->opt_in_jetpack_manage_notice();
37+
}
38+
?>
3439
<?php else : ?>
3540
<h2><?php _e('Once you’ve connected Jetpack, you’ll get access to all the delightful features below.', 'jetpack' ); ?></h2>
3641
<?php endif; ?>

0 commit comments

Comments
 (0)