Last active
December 10, 2015 20:48
-
-
Save DrewAPicture/4490539 to your computer and use it in GitHub Desktop.
Get a user's user settings and parse them into an array. Dumps into the admin footer in the Dashboard.
This file contains hidden or 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 | |
function get_a_users_settings() { | |
// Change 1 to the user's ID | |
// Or do $user = wp_get_current_user() and change $user_id in get_user_option to $user->ID | |
$user_id = 1; | |
$option = get_user_option( 'user-settings', $user_id ); | |
if ( $option && is_string( $option ) ) { | |
parse_str( $option, $array ); | |
echo '<pre>'; | |
var_dump( $array ); | |
echo '</pre>'; | |
} | |
} | |
add_action( 'admin_footer', 'get_a_users_settings' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment