Skip to content

Instantly share code, notes, and snippets.

@yurivictor
Forked from aaronjorbin/color-rotator.php
Last active December 31, 2015 04:09
Show Gist options
  • Save yurivictor/7932164 to your computer and use it in GitHub Desktop.
Save yurivictor/7932164 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' );
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 );
}
@aaronjorbin
Copy link

Forking so you can do it with no hook? 😄

@yurivictor
Copy link
Author

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