function oauth_common_page_user_consumers in OAuth 1.0 7.3
Same name and namespace in other branches
- 6.3 oauth_common.consumers.inc \oauth_common_page_user_consumers()
- 7.4 oauth_common.consumers.inc \oauth_common_page_user_consumers()
Menu system callback for listing a user's consumers.
Parameters
object $account:
1 string reference to 'oauth_common_page_user_consumers'
- oauth_common_providerui_menu in ./
oauth_common_providerui.module - Implements hook_menu().
File
- ./
oauth_common.consumers.inc, line 11
Code
function oauth_common_page_user_consumers($account) {
module_load_include('inc', 'oauth_common');
$ci = oauth_common_user_consumers($account->uid);
$header = array(
array(
'data' => t('Name'),
'class' => array(
'oauth-common-consumer-name',
),
),
array(
'data' => t('Key'),
'class' => array(
'oauth-common-consumer-key',
),
),
array(
'data' => t('Created'),
'class' => array(
'oauth-common-consumer-created',
),
),
array(
'data' => t('Operations'),
'class' => array(
'oauth-common-consumer-operations',
),
),
);
$rows = array();
foreach ($ci as $consumer) {
$data = array(
'name' => array(
'data' => $consumer->name,
'class' => array(
'oauth-common-consumer-name',
),
),
'key' => array(
'data' => substr($consumer->key, 0, 6) . '...',
'class' => array(
'oauth-common-consumer-key',
),
),
'created' => array(
'data' => format_date($consumer->created),
'class' => array(
'oauth-common-consumer-created',
),
),
);
$operations = array();
if (oauth_common_can_edit_consumer($consumer)) {
$operations[] = array(
'title' => t('Edit'),
'href' => sprintf('user/%d/oauth/consumer/%s', $account->uid, $consumer->csid),
);
$operations[] = array(
'title' => t('Delete'),
'href' => sprintf('user/%d/oauth/consumer/%s', $account->uid, $consumer->csid) . '/delete',
);
}
$rows[] = array(
'data' => $data + array(
'operations' => array(
'data' => theme('links', array(
'links' => $operations,
)),
'class' => array(
'oauth-common-consumer-operations',
),
),
),
'class' => array(
'oauth-common-consumer',
),
);
}
$table = theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'oauth-common-list-consumers',
),
));
return $table;
}