506 | | /* Warn the admin if SECRET SALT information is missing from wp-config.php */ |
507 | | function secret_salt_warning() { |
508 | | if ( !is_super_admin() ) |
509 | | return; |
510 | | $secret_keys = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ); |
511 | | $out = ''; |
512 | | foreach( $secret_keys as $key ) { |
513 | | if ( ! defined( $key ) ) |
514 | | $out .= "define( '$key', '" . esc_html( wp_generate_password( 64, true, true ) ) . "' );<br />"; |
515 | | } |
516 | | if ( $out != '' ) { |
517 | | $msg = __( 'Warning! WordPress encrypts user cookies, but you must add the following lines to <strong>wp-config.php</strong> for it to be more secure.' ); |
518 | | $msg .= '<br/>' . __( "Before the line <code>/* That's all, stop editing! Happy blogging. */</code> please add this code:" ); |
519 | | $msg .= "<br/><br/><code>$out</code>"; |
520 | | |
521 | | echo "<div class='update-nag'>$msg</div>"; |
522 | | } |
523 | | } |
524 | | add_action( 'network_admin_notices', 'secret_salt_warning' ); |
525 | | |