| 1 |
<?php |
| 2 |
class WatuShortcodes { |
| 3 |
// displays data from user profile of the currently logged user |
| 4 |
static function userinfo($atts) { |
| 5 |
global $user_ID; |
| 6 |
|
| 7 |
return ''; |
| 8 |
/* |
| 9 |
// let's allow user ID to be passed or taken from certificate |
| 10 |
if(!empty($atts['user_id'])) { |
| 11 |
if(is_numeric($atts['user_id'])) $user_id = $atts['user_id']; |
| 12 |
} |
| 13 |
|
| 14 |
if(empty($user_id) and !is_user_logged_in()) return @$atts[1]; |
| 15 |
if(empty($user_id)) $user_id = $user_ID; |
| 16 |
|
| 17 |
$field = $atts[0]; |
| 18 |
|
| 19 |
$user = get_userdata($user_id); |
| 20 |
|
| 21 |
if(isset($user->data->$field) and !empty($user->data->$field)) return $user->data->$field; |
| 22 |
if(isset($user->data->$field) and empty($user->data->$field)) return @$atts[1]; |
| 23 |
|
| 24 |
// not set? must be in meta then |
| 25 |
$metas = get_user_meta($user_id); |
| 26 |
if(count($metas) and is_array($metas)) { |
| 27 |
foreach($metas as $key => $meta) { |
| 28 |
if($key == $field and !empty($meta[0])) return $meta[0]; |
| 29 |
if($key == $field and empty($meta[0])) return @$atts[1]; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
// nothing found, return the default if any |
| 34 |
return @$atts[1]; |
| 35 |
*/ |
| 36 |
} |
| 37 |
} |
| 38 |
|