diff --git a/includes/admin/assets/css/um-admin-global.css b/includes/admin/assets/css/um-admin-global.css index 4e798f2b..b8d55275 100644 --- a/includes/admin/assets/css/um-admin-global.css +++ b/includes/admin/assets/css/um-admin-global.css @@ -3,6 +3,16 @@ color: #555; } +.um-admin-notice.upgraded { + border-color: #0085ba !important; + color: #555; +} + +.um-admin-notice.error { + border-color: #dc3232 !important; + color: #555; +} + .um-admin-notice a.button-primary { background-color: #0085ba !important; border-color: #0085ba !important; diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php index 1b5b60aa..ab49e5cb 100644 --- a/includes/admin/class-admin.php +++ b/includes/admin/class-admin.php @@ -27,7 +27,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { $this->templates_path = um_path . 'includes/admin/templates/'; add_action( 'admin_init', array( &$this, 'admin_init' ), 0 ); - add_action( 'admin_notices', array( $this, 'check_wrong_install_folder' ), 3 ); + } @@ -54,28 +54,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) { } - /** - * Check if plugin is installed with correct folder - */ - function check_wrong_install_folder() { - $invalid_folder = false; - - $slug_array = explode( '/', um_plugin ); - if ( $slug_array[0] != 'ultimate-member' ) - $invalid_folder = true; - - if ( $invalid_folder ) { ?> - -
- %s with wrong folder name. Correct folder name is "ultimate-member".', 'ultimate-member' ), ultimatemember_plugin_name ) ?> -
-' . sprintf( __( '%s %s requires 2.0 extensions. You have pre 2.0 extensions installed on your site.
Please update %s extensions to latest versions. For more info see this doc.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, 'http://docs.ultimatemember.com/article/266-updating-to-2-0-versions-of-extensions' ) . '
'; - - echo sprintf(__( 'Exif is not enabled on your server. Mobile photo uploads will not be rotated correctly until you enable the exif extension. Hide this notice', 'ultimate-member' ), add_query_arg('um_adm_action', 'um_hide_exif_notice') ); - - echo '
' . __('One or more of your Ultimate Member pages are not correctly setup. Please visit Ultimate Member > Settings to re-assign your missing pages.','ultimate-member') . '
' . __('Ultimate Member Setup Error: User page can not be a child page.','ultimate-member') . '
' . __('Ultimate Member Setup Error: Account page can not be a child page.','ultimate-member') . '
' . sprintf(__( 'Exif is not enabled on your server. Mobile photo uploads will not be rotated correctly until you enable the exif extension. Hide this notice', 'ultimate-member' ), add_query_arg('um_adm_action', 'um_hide_exif_notice') ) . '
', + ), 10 ); } + // Regarding page setup + $pages = UM()->config()->permalinks; + if ( $pages && is_array( $pages ) ) { + + $err = false; + + foreach ( $pages as $slug => $page_id ) { + + $page = get_post( $page_id ); + + if ( ! isset( $page->ID ) && in_array( $slug, array( 'user', 'account', 'members', 'register', 'login', 'logout', 'password-reset' ) ) ) { + $err = true; + } + + } + + if ( $err ) { + $this->add_notice( 'wrong_pages', array( + 'class' => 'updated', + 'message' => '' . __( 'One or more of your Ultimate Member pages are not correctly setup. Please visit Ultimate Member > Settings to re-assign your missing pages.', 'ultimate-member' ) . '
', + ), 20 ); + } + + if ( isset( $pages['user'] ) ) { + $test = get_post( $pages['user'] ); + if ( isset( $test->post_parent ) && $test->post_parent > 0 ) { + $this->add_notice( 'wrong_user_page', array( + 'class' => 'updated', + 'message' => '' . __( 'Ultimate Member Setup Error: User page can not be a child page.', 'ultimate-member' ) . '
', + ), 25 ); + } + } + + if ( isset( $pages['account'] ) ) { + $test = get_post( $pages['account'] ); + if ( isset( $test->post_parent ) && $test->post_parent > 0 ) { + $this->add_notice( 'wrong_account_page', array( + 'class' => 'updated', + 'message' => '' . __( 'Ultimate Member Setup Error: Account page can not be a child page.', 'ultimate-member' ) . '
', + ), 30 ); + } + } + + } } @@ -128,6 +320,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { if ( ! $locale || strstr( $locale, 'en_' ) ) { return; } + if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) { return; } @@ -141,21 +334,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $download_uri = add_query_arg( 'um_adm_action', 'um_language_downloader' ); - echo ''; - - echo sprintf(__('Your site language is %1$s. Good news! Ultimate Member is already available in %2$s language. Download the translation files and start using the plugin in your language now. Hide this notice','ultimate-member'), $locale, UM()->available_languages[$locale], $download_uri, add_query_arg('um_adm_action', 'um_hide_locale_notice') ); - - echo '
' . sprintf( __( 'Your site language is %1$s. Good news! Ultimate Member is already available in %2$s language. Download the translation files and start using the plugin in your language now. Hide this notice','ultimate-member'), $locale, UM()->available_languages[ $locale ], $download_uri, add_query_arg( 'um_adm_action', 'um_hide_locale_notice' ) ) . '
', + ), 40 ); } else { - - echo '';
-
- echo sprintf(__('Ultimate Member has not yet been translated to your langeuage: %1$s. If you have translated the plugin you need put these files ultimatemember-%1$s.po and ultimatemember-%1$s.mo in /wp-content/languages/plugins/ for the plugin to be translated in your language. Hide this notice','ultimate-member'), $locale, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
-
- echo '
' . sprintf( __( 'Ultimate Member has not yet been translated to your language: %1$s. If you have translated the plugin you need put these files ultimatemember-%1$s.po and ultimatemember-%1$s.mo in /wp-content/languages/plugins/ for the plugin to be translated in your language. Hide this notice', 'ultimate-member' ), $locale, add_query_arg( 'um_adm_action', 'um_hide_locale_notice' ) ) . '
' . $message['err_content'] . '
' . $message['err_content'] . '
', + ), 50 ); } else { - echo '' . $message['content'] . '
' . $message['content'] . '
', + ), 50 ); } } } } + + /** + * Check if plugin is installed with correct folder + */ + function check_wrong_install_folder() { + $invalid_folder = false; + + $slug_array = explode( '/', um_plugin ); + if ( $slug_array[0] != 'ultimate-member' ) { + $invalid_folder = true; + } + + if ( $invalid_folder ) { + $this->add_notice( 'invalid_dir', array( + 'class' => 'error', + 'message' => '' . sprintf( __( 'You have installed %s with wrong folder name. Correct folder name is "ultimate-member".', 'ultimate-member' ), ultimatemember_plugin_name ) . '
', + ), 1 ); + } + } + + + /** + * Show admin notices + */ + public function admin_notice_tracking() { + + if ( ! current_user_can( 'manage_options' ) ) + return; + + $hide_notice = get_option( 'um_tracking_notice' ); + + if ( $hide_notice ) + return; + + $optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_into_tracking' ) ); + $optout_url = esc_url( add_query_arg( 'um_adm_action', 'opt_out_of_tracking' ) ); + + ob_start(); ?> + ++ %s! The core plugin is free but we also sell extensions which allow us to continue developing and supporting the plugin full time. If you subscribe to our mailing list (no spam) we will email you a 20%% discount code which you can use to purchase the extensions bundle.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?> +
+ + + + add_notice( 'invalid_dir', array( + 'class' => 'updated', + 'message' => $message, + ), 2 ); + } + + + function check_wrong_licenses() { + $invalid_license = 0; + $arr_inactive_license_keys = array(); + + if ( empty( UM()->admin_settings()->settings_structure['licenses']['fields'] ) ) { + return; + } + + foreach ( UM()->admin_settings()->settings_structure['licenses']['fields'] as $field_data ) { + $license = get_option( "{$field_data['id']}_edd_answer" ); + + if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) + continue; + + if ( ( is_object( $license ) && 'inactive' == $license->license ) || 'inactive' == $license ) { + $arr_inactive_license_keys[ ] = $license->item_name; + } + + $invalid_license++; + } + + if ( ! empty( $arr_inactive_license_keys ) ) { + $this->add_notice( 'license_key', array( + 'class' => 'error', + 'message' => '' . sprintf( __( 'There are %d inactive %s license keys for this site. This site is not authorized to get plugin updates. You can active this site on www.UltimateMember.com.', 'ultimate-member' ), count( $arr_inactive_license_keys ) , ultimatemember_plugin_name, 'https://ultimatemember.com' ) . '
', + ), 3 ); + } + + if ( $invalid_license ) { + $this->add_notice( 'license_key', array( + 'class' => 'error', + 'message' => '' . sprintf( __( 'You have %d invalid or expired license keys for %s. Please go to the Licenses page to correct this issue.', 'ultimate-member' ), $invalid_license, ultimatemember_plugin_name, add_query_arg( array('page'=>'um_options', 'tab' => 'licenses'), admin_url( 'admin.php' ) ) ) . '
', + ), 3 ); + } + } + + + function need_upgrade() { + if ( ! empty( UM()->admin_upgrade()->necessary_packages ) ) { + $this->add_notice( 'upgrade', array( + 'class' => 'error', + 'message' => '' . sprintf( __( '%s version %s needs to be updated. Please visit to "Upgrade" page here and run the upgrade process.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, add_query_arg( array( 'page' => 'um_upgrade' ), admin_url( 'admin.php' ) ) ) . '
', + ), 4 ); + } else { + if ( isset( $_GET['msg'] ) && 'updated' == $_GET['msg'] ) { + $this->add_notice( 'upgrade', array( + 'class' => 'updated', + 'message' => '' . __( 'Successfully Upgraded', 'ultimate-member' ) . '
', + ), 4 ); + } + } + } + } } \ No newline at end of file diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 82ece580..d6a36e93 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -76,7 +76,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { add_filter( 'um_change_settings_before_save', array( $this, 'remove_empty_values' ), 10, 1 ); //invalid licenses notice - add_action( 'admin_notices', array( $this, 'check_wrong_licenses' ) ); + //add_action( 'admin_notices', array( $this, 'check_wrong_licenses' ) ); add_action( 'admin_init', array( &$this, 'um_download_install_info' ) ); diff --git a/includes/admin/core/class-admin-upgrade.php b/includes/admin/core/class-admin-upgrade.php index 3a74d93b..bdb5fea3 100644 --- a/includes/admin/core/class-admin-upgrade.php +++ b/includes/admin/core/class-admin-upgrade.php @@ -39,16 +39,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) { $this->necessary_packages = $this->need_run_upgrades(); if ( ! empty( $this->necessary_packages ) ) { - add_action( 'admin_notices', array( $this, 'need_upgrade' ) ); + //add_action( 'admin_notices', array( $this, 'need_upgrade' ) ); $this->init_packages_ajax(); add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 ); add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) ); add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) ); - } else { - add_action( 'admin_notices', array( $this, 'updated_successfully' ) ); - } + } /*else { + //add_action( 'admin_notices', array( $this, 'updated_successfully' ) ); + }*/ } diff --git a/includes/class-init.php b/includes/class-init.php index 98b2a654..a8517490 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -1,6 +1,5 @@ - 'Svenska', 'pl_PL' => 'Polski', 'cs_CZ' => 'Czech', - 'el' => 'Greek', + 'el' => 'Greek', 'id_ID' => 'Indonesian', 'zh_CN' => '简体中文', 'ru_RU' => 'Русский', 'tr_TR' => 'Türkçe', 'fa_IR' => 'Farsi', 'he_IL' => 'Hebrew', - 'ar' => 'العربية', + 'ar' => 'العربية', ); /** @@ -275,7 +274,7 @@ if ( ! class_exists( 'UM' ) ) { // include hook files add_action( 'plugins_loaded', array( &$this, 'init' ), 0 ); - add_action( 'init', array( &$this, 'old_extensions_notice' ), 0 ); + //add_action( 'init', array( &$this, 'old_extensions_notice' ), 0 ); //run activation register_activation_hook( um_plugin, array( &$this, 'activation' ) ); @@ -294,7 +293,7 @@ if ( ! class_exists( 'UM' ) ) { /** * Show notice for customers with old extension's versions */ - function old_extensions_notice() { + /*function old_extensions_notice() { if ( ! is_admin() ) { return; } @@ -326,10 +325,10 @@ if ( ! class_exists( 'UM' ) ) { /*global $um_woocommerce; remove_action( 'init', array( $um_woocommerce, 'plugin_check' ), 1 ); - $um_woocommerce->plugin_inactive = true;*/ + $um_woocommerce->plugin_inactive = true;* echo '' . sprintf( __( '%s %s requires 2.0 extensions. You have pre 2.0 extensions installed on your site.
Please update %s extensions to latest versions. For more info see this doc.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, 'http://docs.ultimatemember.com/article/266-updating-to-2-0-versions-of-extensions' ) . '
'; - - printf( __( 'Thanks for installing %s! The core plugin is free but we also sell extensions which allow us to continue developing and supporting the plugin full time. If you subscribe to our mailing list (no spam) we will email you a 20%% discount code which you can use to purchase the extensions bundle.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); - - echo '
'; - - echo '' . __( 'Subscribe to mailing list', 'ultimate-member' ) . ''; - echo ' ' . __( 'No thanks', 'ultimate-member' ) . '