function get_counts($profile_id = false, $context = 'profile')
{
if (false === $profile_id && 'profile' === $context) {
$profile_id = $this->profile_id();
} else {
if (false === $profile_id && 'profile' === $context) {
$profile_id = $this->group_id();
}
}
if (!$profile_id) {
return false;
}
if ('profile' === $context) {
//todo user attr
$counts = get_user_meta($profile_id, 'rtmedia_counts_' . get_current_blog_id(), true);
if (empty($counts)) {
$counts = $this->refresh_counts($profile_id, array('context' => $context, 'media_author' => $profile_id));
}
} else {
if (function_exists('groups_get_groupmeta') && ($context = 'group')) {
$counts = groups_get_groupmeta($profile_id, 'rtmedia_counts_' . get_current_blog_id());
if (empty($counts)) {
$counts = $this->refresh_counts($profile_id, array('context' => $context, 'context_id' => $profile_id));
}
}
}
return $counts;
}