Skip to content

Instantly share code, notes, and snippets.

@ryelle
Forked from aaronjorbin/color-rotator.php
Last active December 31, 2015 04:09
Show Gist options
  • Save ryelle/7932411 to your computer and use it in GitHub Desktop.
Save ryelle/7932411 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Color Rotator
Description: Change the color scheme every time you login
Author: Aaron Jorbin
Version: 1.0
Author URI: http://aaron.jorb.in/
License: GPLv2 or later
*/
// Every time a user logs in, change the color scheme
add_action( 'wp_login', 'jorbin_color_rotate', 10, 2 );
function jorbin_color_rotate( $user_login, $user ) {
$new_colors = array( 'fresh', 'light', 'blue', 'midnight', 'sunrise', 'ectoplasm', 'ocean', 'coffee' );
$color_scheme = $new_colors[ array_rand( $new_colors ) ];
update_user_meta( $user->ID, 'admin_color', $color_scheme );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment