By Tim on Tuesday, 31 December 2013
Replies 6
Likes 0
Views 0.9K
Votes 0
Is there any way to display the avatars and names Team Blog members? I would like to create a module that does this (each avatar would link to thatindividual's blog). I have some PHP knowledge, so if you could point me in the right direction, I'd appreciate it!
Hello Tim,

So sorry for the delay in getting back to you. Actually you can use the team blog module and get the team blog members and also the avatar. To get the members you will need to access the model file

$model = EasyBlogHelper::getModel( 'TeamBlogs' );
$data = $model->getTeamMembers($teamId)

Then you can get the individual user id and get the avatar with the user ID
for($i = 0; $i < count($data); $i++)
{
$member =& $data[$i];

$profile = EasyBlogHelper::getTable( 'Profile', 'Table' );
$profile->load( $member->user_id );
$profile->displayName = $profile->getName();
$profile->getAvatar();
$profile->getProfileLink();
}

Please give it a shot.
Hope this helps.
·
Tuesday, 07 January 2014 10:23
·
0 Likes
·
0 Votes
·
0 Comments
·
I'm attaching an example of the desired outcome.
Tim
·
Tuesday, 31 December 2013 04:04
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Tim,

It will need major hack to your module. But you can start with our Team Blog Module for sure.
·
Tuesday, 31 December 2013 12:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Nik, I've been looking into it further.. it seems like it would be easier just to modify the "most active bloggers" module. If you could provide an adapted version of the below function, so that it just returns the member user ID's given the currently loaded teamblog ID, that would be awesome.

class modEasyBlogMostActiveBloggerHelper
{
function getBloggers(&$params)
{
if(file_exists(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'helper.php'))
require_once (JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'helper.php');

$mainframe = JFactory::getApplication();
$db = EasyBlogHelper::db();

$count = (INT)trim($params->get('count', 0));
$excludeemptypost = $params->get('excludeemptypost', 0);
$onlyFeatured = $params->get('onlyfeatured', 0);
$catids = $params->get('catid', '');
$catids = ( empty( $catids ) ) ? '' : explode(',' , $catids );

$query = 'SELECT x.*, count(p.`id`) as `post_count` FROM (';
$query .= ' (SELECT a.`id`, a.`registerDate`';
$query .= ' FROM `#__users` AS `a`';
$query .= ' INNER JOIN `#__easyblog_users` AS `b` ON a.`id` = b.`id`';

if( $onlyFeatured )
$query .= ' INNER JOIN `#__easyblog_featured` AS `fb` ON a.`id` = fb.`content_id` and fb.`type` = ' . $db->Quote('blogger');

if(EasyBlogHelper::getJoomlaVersion() >= '1.6'){
$query .= ' INNER JOIN `#__user_usergroup_map` AS `d` ON a.`id` = d.`user_id`';
} else {
$query .= ' INNER JOIN `#__core_acl_aro` AS `c` ON a.`id` = c.`value`';
$query .= ' AND c.`section_value` = ' . $db->Quote('users');
$query .= ' INNER JOIN `#__core_acl_groups_aro_map` AS `d` ON c.`id` = d.`aro_id`';
}

$query .= ' INNER JOIN `#__easyblog_acl_group` AS `e` ON d.`group_id` = e.`content_id`';
$query .= ' AND e.`type` = ' . $db->Quote('group') . ' AND e.`status` = 1';
$query .= ' INNER JOIN `#__easyblog_acl` as `f` ON e.`acl_id` = f.`id`';
$query .= ' AND f.`action` = ' . $db->Quote('add_entry') . ')';
$query .= ' UNION ';
$query .= ' (SELECT a1.`id`, a1.`registerDate`';
$query .= ' FROM `#__users` AS `a1`';
$query .= ' INNER JOIN `#__easyblog_users` AS `b1` ON a1.`id` = b1.`id`';

if( $onlyFeatured )
$query .= ' INNER JOIN `#__easyblog_featured` AS `fb1` ON a1.`id` = fb1.`content_id` and fb1.`type` = ' . $db->Quote('blogger');

$query .= ' INNER JOIN `#__easyblog_acl_group` AS `c1` ON a1.`id` = c1.`content_id`';
$query .= ' AND c1.`type` = ' . $db->Quote('assigned') . ' AND c1.`status` = 1';
$query .= ' INNER JOIN `#__easyblog_acl` as `d1` ON c1.`acl_id` = d1.`id`';
$query .= ' AND d1.`action` = ' . $db->Quote('add_entry') . ')';
$query .= ' ) as x LEFT JOIN `#__easyblog_post` AS p ON x.`id` = p.`created_by`';

if( !empty($catids) )
{
$query .= ' and p.`category_id` IN (' . implode(',', $catids) . ')';
}

if($excludeemptypost)
{
$query .= ' GROUP BY x.`id` HAVING (count(p.`id`) > 0)';
}
else
{
$query .= ' GROUP BY x.`id`';
}


$query .= ' ORDER BY count(p.`id`) DESC';


if($count > 0)
$query .= ' LIMIT ' . $count;

$db->setQuery($query);

$bloggers = $db->loadObjectList();
return $bloggers;
}
Tim
·
Tuesday, 07 January 2014 06:33
·
0 Likes
·
0 Votes
·
0 Comments
·
That helped a lot. Thank you!
Tim
·
Wednesday, 08 January 2014 04:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Tim,

You're welcome.
·
Wednesday, 08 January 2014 08:55
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post