function quotes_user_form in Quotes 5
Same name and namespace in other branches
- 6 quotes.user.inc \quotes_user_form()
- 7 quotes.user.inc \quotes_user_form()
1 string reference to 'quotes_user_form'
- quotes_user_page in ./
quotes.user.inc - @file Displays a Drupal page containing quotes submitted by a given user.
File
- ./
quotes.user.inc, line 18 - Displays a Drupal page containing quotes submitted by a given user.
Code
function quotes_user_form($account) {
global $user;
$destination = drupal_get_destination();
$options = array();
$now = $_SERVER['REQUEST_TIME'];
$limit = variable_get('quotes_per_page', 10);
$node_ops = module_invoke_all('node_operations');
$account = user_load(array(
'uid' => $account,
));
$query = db_rewrite_sql("SELECT n.* FROM {node} n WHERE n.uid=%d AND n.type='quotes' ORDER BY n.changed DESC");
$result = pager_query($query, $limit, 0, NULL, $account->uid);
while ($node = db_fetch_object($result)) {
$status = array();
$status[] = $node->status ? t('published') : t('not published');
if ($node->promoted) {
$status[] = t('promoted');
}
if ($node->sticky > 0) {
// >0 allows for sticky-encoded weighting.
$status[] = t('sticky');
}
if ($node->moderated) {
$status[] = t('moderated');
}
$form['title'][$node->nid] = array(
'#value' => l($node->title, 'node/' . $node->nid) . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
);
$form['status'][$node->nid] = array(
'#value' => implode(', ', $status),
);
$form['updated'][$node->nid] = array(
'#value' => format_interval($now - $node->changed),
);
$tid_list = array();
$terms = db_query("SELECT tn.tid, td.name FROM {term_node} tn LEFT JOIN {term_data} td USING (tid) WHERE tn.nid=%d", $node->nid);
while ($row = db_fetch_array($terms)) {
$tid_list[] = check_plain($row['name']);
}
$form['group'][$node->nid] = array(
'#value' => implode(', ', $tid_list),
);
if (_quotes_user_form_access($user, $account)) {
$form['operationse'][$node->nid] = array(
'#value' => l(t('edit'), 'node/' . $node->nid . '/edit', array(), $destination),
);
$form['operationsd'][$node->nid] = array(
'#value' => l(t('delete'), 'node/' . $node->nid . '/delete', array(), $destination),
);
}
}
$form['pager'] = array(
'#value' => theme('pager', NULL, $limit, 0),
);
return $form;
}