function userpoints_get_transaction_actions in User Points 7
Returns a list of operations as links.
Parameters
$transaction: Transaction object.
$show_view: FALSE if the view link should not be displayed. Defaults to TRUE.
Return value
A string with operation links.
2 calls to userpoints_get_transaction_actions()
- userpoints_get_transaction_row in ./
userpoints.module - Returns a single row for a transaction listing.
- userpoints_view_transaction in ./
userpoints.pages.inc - Menu callback; display details about a specific transaction.
File
- ./
userpoints.module, line 1891
Code
function userpoints_get_transaction_actions($transaction, $show_view = TRUE) {
global $user;
$actions = array();
$url_options = array(
'query' => drupal_get_destination(),
);
$url_prefix = 'myuserpoints/transaction/' . $transaction->txn_id;
if (strpos($_GET['q'], 'admin/config/people/userpoints') !== FALSE) {
$url_prefix = "admin/config/people/userpoints/transaction/{$transaction->txn_id}";
}
elseif ($transaction->uid != $user->uid) {
$url_prefix = "user/{$transaction->uid}/points/{$transaction->txn_id}";
}
if ($show_view && userpoints_access_view_transaction($transaction)) {
$actions[] = l(t('view'), $url_prefix . '/view');
}
if (userpoints_admin_access('edit')) {
$actions[] = l(t('edit'), $url_prefix . '/edit', $url_options);
}
if (userpoints_admin_access('moderate') && $transaction->status == USERPOINTS_TXN_STATUS_PENDING) {
$actions[] = l(t('approve'), $url_prefix . '/approve', $url_options);
$actions[] = l(t('decline'), $url_prefix . '/decline', $url_options);
}
return implode(' ', $actions);
}