From 246f80fc39200b7a603de15c31e9636a580e3d3c Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 22 Apr 2008 14:51:22 +0000 Subject: Warn the site admin if SECRET_SALT and SECRET_SALT are not defined git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1254 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/includes/mu.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wp-admin/includes/mu.php b/wp-admin/includes/mu.php index 1579085..9a57663 100644 --- a/wp-admin/includes/mu.php +++ b/wp-admin/includes/mu.php @@ -639,4 +639,20 @@ EOF; } add_action( 'media_buttons', 'mu_media_buttons' ); remove_action( 'media_buttons', 'media_buttons' ); + +/* Warn the admin if SECRET SALT information is missing from wp-config.php */ +function secret_salt_warning() { + if( !is_site_admin() ) + return; + if( !defined( 'SECRET_KEY' ) || !defined( 'SECRET_SALT' ) ) { + $salt1 = wp_generate_password() . wp_generate_password(); + $salt2 = wp_generate_password() . wp_generate_password(); + $msg = sprintf( __( 'Warning! You must define SECRET_KEY and SECRET_SALT in %swp-config.php
Please add the following code before the line, /* That\'s all, stop editing! Happy blogging. */' ), ABSPATH ); + $msg .= "
define('SECRET_KEY', '$salt1');
define('SECRET_SALT', '$salt2');
"; + + echo "
$msg
"; + } +} +add_action( 'admin_notices', 'secret_salt_warning' ); + ?> -- cgit