Some install tweaks
This commit is contained in:
parent
f3cf06299b
commit
bfdf71fd26
|
@ -49,6 +49,26 @@ function woocommerce_admin_install_notice() {
|
|||
</div>
|
||||
<?php
|
||||
}
|
||||
function woocommerce_admin_installed_notice() {
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<div class="squeezer">
|
||||
<h4><?php _e( '<strong>WooCommerce has been installed</strong> – Your ready to start selling :)', 'woocommerce' ); ?></h4>
|
||||
|
||||
<p class="submit"><a href="<?php echo admin_url('admin.php?page=woocommerce'); ?>" class="button-primary"><?php _e( 'Settings', 'woocommerce' ); ?></a> <a class="docs button-primary" href="http://www.woothemes.com/woocommerce-docs/"><?php _e('Documentation', 'woocommerce'); ?></a></p>
|
||||
|
||||
<p><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="A open-source (free) #ecommerce plugin for #WordPress that helps you sell anything. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="WooCommerce">Tweet</a>
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
// Flush rules after install
|
||||
flush_rewrite_rules( false );
|
||||
|
||||
// Set installed option
|
||||
update_option('woocommerce_installed', 0);
|
||||
}
|
||||
function woocommerce_admin_notices_styles() {
|
||||
|
||||
if ( get_option('woocommerce_installed')==1 ) {
|
||||
|
@ -57,6 +77,8 @@ function woocommerce_admin_notices_styles() {
|
|||
|
||||
if (get_option('skip_install_woocommerce_pages')!=1 && woocommerce_get_page_id('shop')<1 && !isset($_GET['install_woocommerce_pages']) && !isset($_GET['skip_install_woocommerce_pages'])) {
|
||||
add_action( 'admin_notices', 'woocommerce_admin_install_notice' );
|
||||
} elseif ( !isset($_GET['page']) || $_GET['page']!='woocommerce' ) {
|
||||
add_action( 'admin_notices', 'woocommerce_admin_installed_notice' );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1006,10 +1006,12 @@ function woocommerce_settings() {
|
|||
|
||||
$current_tab = (isset($_GET['tab'])) ? $_GET['tab'] : 'general';
|
||||
|
||||
if( isset( $_POST ) && $_POST ) :
|
||||
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-settings' ) ) die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
// Save settings
|
||||
if( isset( $_POST ) && $_POST ) {
|
||||
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-settings' ) )
|
||||
die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
|
||||
switch ( $current_tab ) :
|
||||
switch ( $current_tab ) {
|
||||
case "general" :
|
||||
case "pages" :
|
||||
case "catalog" :
|
||||
|
@ -1020,34 +1022,37 @@ function woocommerce_settings() {
|
|||
case "integration" :
|
||||
woocommerce_update_options( $woocommerce_settings[$current_tab] );
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_update_options' );
|
||||
do_action( 'woocommerce_update_options_' . $current_tab );
|
||||
|
||||
// Backwards compat 1.4 <
|
||||
if ($current_tab=='shipping') do_action( 'woocommerce_update_options_shipping_methods' );
|
||||
if ($current_tab=='shipping') do_action( 'woocommerce_update_options_shipping_methods' ); // Shipping Methods
|
||||
|
||||
flush_rewrite_rules( false );
|
||||
|
||||
wp_redirect( add_query_arg( 'subtab', esc_attr(str_replace('#', '', $_POST['subtab'])), add_query_arg( 'saved', 'true', admin_url( 'admin.php?page=woocommerce&tab=' . $current_tab ) )) );
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['saved']) && $_GET['saved']) :
|
||||
// Settings saved message
|
||||
if (isset($_GET['saved']) && $_GET['saved']) {
|
||||
echo '<div id="message" class="updated fade"><p><strong>' . __( 'Your settings have been saved.', 'woocommerce' ) . '</strong></p></div>';
|
||||
|
||||
flush_rewrite_rules( false );
|
||||
|
||||
do_action('woocommerce_settings_saved');
|
||||
endif;
|
||||
}
|
||||
|
||||
// Hide WC Link
|
||||
if (isset($_GET['hide-wc-extensions-message']))
|
||||
update_option('hide-wc-extensions-message', 1);
|
||||
|
||||
// Install/page installer
|
||||
$install_complete = false;
|
||||
$show_page_installer = false;
|
||||
|
||||
// Hide WC Link
|
||||
if (isset($_GET['hide-wc-extensions-message'])) update_option('hide-wc-extensions-message', 1);
|
||||
|
||||
// Add pages button
|
||||
if (isset($_GET['install_woocommerce_pages']) && $_GET['install_woocommerce_pages']) :
|
||||
if (isset($_GET['install_woocommerce_pages']) && $_GET['install_woocommerce_pages']) {
|
||||
|
||||
require_once( 'woocommerce-admin-install.php' );
|
||||
woocommerce_create_pages();
|
||||
|
@ -1055,27 +1060,15 @@ function woocommerce_settings() {
|
|||
$install_complete = true;
|
||||
|
||||
// Skip button
|
||||
elseif (isset($_GET['skip_install_woocommerce_pages']) && $_GET['skip_install_woocommerce_pages']) :
|
||||
} elseif (isset($_GET['skip_install_woocommerce_pages']) && $_GET['skip_install_woocommerce_pages']) {
|
||||
|
||||
update_option('skip_install_woocommerce_pages', 1);
|
||||
$install_complete = true;
|
||||
|
||||
// If we have just activated WooCommerce...
|
||||
elseif (get_option('woocommerce_installed')==1) :
|
||||
|
||||
flush_rewrite_rules( false );
|
||||
|
||||
if (woocommerce_get_page_id('shop')>0) :
|
||||
$install_complete = true;
|
||||
endif;
|
||||
|
||||
endif;
|
||||
}
|
||||
|
||||
if ($install_complete) :
|
||||
|
||||
update_option('woocommerce_installed', 0);
|
||||
|
||||
?>
|
||||
if ($install_complete) {
|
||||
?>
|
||||
<div id="message" class="updated woocommerce-message wc-connect">
|
||||
<div class="squeezer">
|
||||
<h4><?php _e( '<strong>Congratulations!</strong> – WooCommerce has been installed and setup. Enjoy :)', 'woocommerce' ); ?></h4>
|
||||
|
@ -1085,9 +1078,12 @@ function woocommerce_settings() {
|
|||
</div>
|
||||
<?php
|
||||
|
||||
flush_rewrite_rules( false );
|
||||
|
||||
endif;
|
||||
// Flush rules after install
|
||||
flush_rewrite_rules( false );
|
||||
|
||||
// Set installed option
|
||||
update_option('woocommerce_installed', 0);
|
||||
}
|
||||
?>
|
||||
<div class="wrap woocommerce">
|
||||
<form method="post" id="mainform" action="">
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
outline: none;
|
||||
opacity: 1;
|
||||
}
|
||||
.woocommerce-message p a.skip {
|
||||
.woocommerce-message p a.skip, .woocommerce-message p a.docs {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.woocommerce-message .twitter-share-button {
|
||||
|
|
Loading…
Reference in New Issue