-
-
Save yurivictor/7932164 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
function jorbin_color_rotate() { | |
$new_colors = array( 'fresh', 'light', 'blue', 'midnight', 'sunrise', 'ocean', 'coffee' ); | |
$color_scheme = array_rand( $new_colors, 1 ); | |
update_user_meta( get_current_user_id(), 'admin_color', $color_scheme ); | |
} |
I was originally just going to fix your spacing, but then ... I just couldn't do ectoplasm something something crossing streams slimer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forking so you can do it with no hook? 😄