Display user info

WordPress allows user to add information about themselves in their profile page in WP Admin. To display the users information, you can use this snippet.

You can also add and remove your own information fields with this snippet.

Code Snippet:

<?php
global $current_user;
get_currentuserinfo();
$user_id = $current_user->ID; // You can set $user_id to any users, but this gets the current users ID.

$user_twitter = get_user_meta( $user_id, 'twitter', true);
echo $user_twitter;
?>

Posted in Pure hacks