I'm new to Drupal, and I'm using Organic Groups to make groups. The site is supposed to be a multi-blog platform where groups can have their own group and the group admin(only) should be able to get a list of all group members (linked to their blogs) in the side menu. How am I able to achieve this? Any help would be appreciated!
I found the following code from here:
<?php
$query = db_select('node', 'n');
$query->join('users', 'u', 'n.uid = u.uid');
$query->join('file_managed', 'f', 'f.fid = u.picture');
$query->fields('u',array('name'));
$query->fields('n',array('type'));
$query->fields('f',array('filename'));
$query->fields('u',array('uid'));
$query->condition('u.status', 1);
$query->condition('n.status', 1);
$query->condition('n.type', 'blog', '=');
$query->addExpression('COUNT(n.uid)');
$query->groupBy('u.uid');
$query->groupBy('n.type');
$query->orderBy('COUNT(n.uid)', 'DESC');
$result = $query->execute();
$output = array();
while($record = $result->fetchAssoc()) {
// print $record ;
$output = '<div class="bloglist_row">';
$output .= '<div class="bloglist_userimage"><img style="width:100%;" src="./sites/default/files/styles/thumbnail/public/pictures/'.$record['filename'].'"></div>';
$output .= '<div class="bloglist_row_body"><a href="blog/'.$record['uid']. '">'.$record['name']. 's Blog</a><br />Posts: ('.$record['expression'].')</div>';
$output .= '</div>';
$output .= '<img src="blog_spacer.jpg" width="220" height="25" />';
// $output .= '<li />'.l($record['name']. ' ('.$record['expression'].')', 'blog/'.$record['uid']);
}
echo $output;
?>
Unfortunately this gives me the following error:
Notice: Array to string conversion in include()
on the last line (echo $output
).
Any ideas on how I can achieve this with using Views?