Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

New feature: Disabler: Disable multisite welcome screen

  • Loading branch information...
commit dcf3c0d8bef217bf43f1e53b28a41e856502f3bd 1 parent 24d446a
@kucrut authored
View
8 kc-essentials-inc/_options.php
@@ -65,6 +65,14 @@ public static function register( $settings ) {
'options' => array(
'menu_cpt_archive' => sprintf( __('Custom post type archive menu %s', 'kc-essentials'), '<a title="'.__('What&#39;s this?', 'kc-essentials').'" href="#tab-link-menu_cpt_archive" class="kc-help-trigger">?</a>' )
)
+ ),
+ 'disabler' => array(
+ 'id' => 'disabler',
+ 'title' => __('Disabler', 'kc-essentials'),
+ 'type' => 'checkbox',
+ 'options' => array(
+ 'ms_hide_wc_screen' => __('Hide welcome screen on multisite', 'kc-essentials')
+ )
)
)
)
View
41 kc-essentials-inc/disabler.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Disabler module
+ *
+ * @package KC_Essentials
+ * @since 0.2.1
+ */
+
+class kcEssentials_disabler {
+ private static $data = array();
+
+
+ public static function init() {
+ $items = kcEssentials::get_data( 'settings', 'components', 'disabler' );
+ if ( empty($items) )
+ return;
+
+ self::$data['items'] = $items;
+ foreach ( $items as $item )
+ call_user_func( array(__CLASS__, $item) );
+ }
+
+
+ private static function ms_hide_wc_screen() {
+ add_action( 'load-index.php', array(__CLASS__, 'ms_hide_wc_screen_action') );
+ }
+
+
+ public static function ms_hide_wc_screen_action() {
+ if ( !is_multisite() )
+ return;
+
+ if ( 2 === (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true ) )
+ update_user_meta( get_current_user_id(), 'show_welcome_panel', 0 );
+ }
+}
+
+kcEssentials_disabler::init();
+
+?>
View
10 kc-essentials.php
@@ -92,10 +92,16 @@ public static function _sns_register() {
public static function _component_activation() {
- foreach ( self::$data['settings']['components'] as $group )
- foreach ( $group as $component )
+ foreach ( self::$data['settings']['components'] as $group => $items ) {
+ if ( file_exists( self::$data['paths']['inc'] . "/{$group}.php") ) {
+ require_once self::$data['paths']['inc'] . "/{$group}.php";
+ continue;
+ }
+
+ foreach ( $items as $component )
if ( file_exists( self::$data['paths']['inc'] . "/{$component}.php") )
require_once self::$data['paths']['inc'] . "/{$component}.php";
+ }
}

0 comments on commit dcf3c0d

Please sign in to comment.
Something went wrong with that request. Please try again.