" 指定用户)、$content。
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
// 解析目标用户:属性指定 > 当前登录用户。
$target = isset($attrs['user']) ? trim((string) $attrs['user']) : '';
$user = null;
if ($target !== '') {
$user = is_numeric($target) ? get_user_by('id', (int) $target) : get_user_by('login', $target);
} elseif (is_user_logged_in()) {
$user = wp_get_current_user();
}
if (!($user instanceof WP_User) || $user->ID <= 0) {
echo '
';
return;
}
$user_id = (int) $user->ID;
$avatar = function_exists('aksrt_get_avatar_url') ? aksrt_get_avatar_url($user_id, ['size' => 96]) : get_avatar_url($user_id, ['size' => 96]);
$home_url = function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_url($user) : get_author_posts_url($user_id);
$credits = function_exists('aksrt_user_credits') ? (int) aksrt_user_credits($user_id) : 0;
$post_count = (int) count_user_posts($user_id, 'post', true);
$bio = function_exists('aksrt_get_user_description') ? aksrt_get_user_description($user_id) : (string) get_the_author_meta('description', $user_id);
$show_credits = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::credits_enabled() : true;
?>