Skip to content

Commit

Permalink
New build
Browse files Browse the repository at this point in the history
  • Loading branch information
ebinnion committed Oct 2, 2017
1 parent 1c57d02 commit 75ebf5e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,39 @@ function add_jpo_wizard() {
return;
}
?>
<div id='jpo-welcome-panel'><span class='screen-reader-text'>Loading Welcome Wizard</span></div>
Jetpack_Onboarding_WelcomePanel::render_widget();
<?php
}
```

Here's a more complete example that shows how to show the wizard on the Profile screen, as opposed to all screens:

```php
add_action( 'current_screen', 'jetpack_onboarding_show_on_profile' );
function jetpack_onboarding_show_on_profile( $screen ) {
if ( 'profile' == $screen->base ) {
// add assets
add_action( 'admin_enqueue_scripts', array( 'Jetpack_Onboarding_WelcomePanel', 'add_wizard_assets' ) );
// add wizard HTML
add_action( 'admin_notices', 'add_jpo_wizard' );
}
}

function add_jpo_wizard() {
if ( get_option( Jetpack_Onboarding_EndPoints::HIDE_FOR_ALL_USERS_OPTION ) ) {
return;
}

Jetpack_Onboarding_WelcomePanel::render_widget();
}
```

If you decide to show the wizard on another page, you may also want to disable showing the wizard on the dashboard. To do this, you can do the following:

```php
add_filter( 'jetpack_onboarding_show_on_dashboard', '__return_false' );
```

## Styling

### Move the top of the wizard down to expose top elements in dashboard
Expand Down
2 changes: 1 addition & 1 deletion class.jetpack-onboarding-end-points.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Jetpack_Onboarding_EndPoints {
const BUSINESS_ADDRESS_SAVED_KEY = 'jpo_business_address_saved';
const MAX_THEMES = 3;
const NUM_RAND_THEMES = 3;
const VERSION = '1.7.1';
const VERSION = '1.7.3';
const WOOCOMMERCE_ID = 'woocommerce/woocommerce.php';
const WOOCOMMERCE_SLUG = 'woocommerce';
const HIDE_FOR_ALL_USERS_OPTION = 'jpo_hide_always';
Expand Down
14 changes: 12 additions & 2 deletions class.jetpack-onboarding-welcome-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@ class Jetpack_Onboarding_WelcomePanel {

static function init() {
add_filter( 'update_user_metadata', array( __CLASS__, 'check_for_widget_visibility' ), 10, 5 );
add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_dashboard_widgets' ) );
add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_wizard_assets' ) );

/**
* Should the Jetpack Onboarding wizard be displayed on the dashboard?
*
* @since 1.7.3
*
* @param bool true Should the wizard be shown on the dashboard?
*/
if ( apply_filters( 'jetpack_onboarding_show_on_dashboard', true ) ) {
add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_dashboard_widgets' ) );
add_action( 'wp_dashboard_setup', array( __CLASS__, 'add_wizard_assets' ) );
}
}

static function check_for_widget_visibility( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
Expand Down
2 changes: 1 addition & 1 deletion jetpack-onboarding.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Jetpack Onboarding
* Plugin URI: https://github.com/automattic/jetpack-onboarding
* Description: Jetpack Onboarding Wizard.
* Version: 1.7.1
* Version: 1.7.3
*/

require_once( plugin_dir_path( __FILE__ ) . 'class.jetpack-onboarding-end-points.php' );
Expand Down

0 comments on commit 75ebf5e

Please sign in to comment.