function workspace_list_comments in Workspace 6
Same name and namespace in other branches
- 7 workspace.module \workspace_list_comments()
Menu callback. Display list of comments.
Parameters
$account: User object representing user whose workspace is being listed.
1 string reference to 'workspace_list_comments'
- workspace_menu in ./
workspace.module - Implementation of hook_menu().
File
- ./
workspace.module, line 283 - Presents a user-centric view of content.
Code
function workspace_list_comments($account) {
drupal_set_title(t('Workspace: @name', array(
'@name' => $account->name,
)));
$max = isset($account->workspaces) ? $account->workspaces['default']['maxcomments'] : 50;
$sql = 'SELECT c.nid, c.uid, c.cid, c.subject, c.status, c.timestamp, c.pid, 0
FROM {comments} c
WHERE c.uid = %d';
$count_sql = 'SELECT COUNT(cid) FROM {comments} WHERE uid = %d';
// Build the comment listing.
$header = array(
array(
'data' => t('Title'),
'field' => 'title',
),
array(
'data' => t('Published'),
'field' => 'status',
),
array(
'data' => t('Modified'),
'field' => 'timestamp',
'sort' => 'desc',
),
array(
'data' => t('Replies'),
'field' => 'comment_count',
),
array(
'data' => t('Operations'),
'colspan' => 2,
),
);
$cols = 6;
$result = pager_query($sql . tablesort_sql($header), $max, 0, $count_sql, $account->uid);
$rows = workspace_build_rows($result, $account);
return theme_workspace_list($header, $rows, $max, $cols);
}