function uc_recurring_user_table in UC Recurring Payments and Subscriptions 6
1 call to uc_recurring_user_table()
- uc_recurring_user in ./
uc_recurring.module - Implementation of hook_user().
File
- ./
uc_recurring.module, line 652 - Allows you to add a recurring fee to a product/SKU to handle subscription type services.
Code
function uc_recurring_user_table($uid) {
$rows = array();
$output = '';
// Set up a header array for the table.
$header = array(
t('Order'),
t('Amount'),
t('Interval'),
t('Next charge'),
t('Remaining'),
t('Operations'),
);
$context = array(
'revision' => 'themed-original',
'location' => 'recurring-user-table',
);
// Loop through the fees sorted by the order ID descending.
$result = db_query("SELECT * FROM {uc_recurring_users} WHERE uid = %d AND remaining_intervals > 0 ORDER BY order_id DESC", $uid);
while ($fee = db_fetch_array($result)) {
$ops = array();
// Get the $ops from the module implementing the handler.
$callback = $fee['fee_handler'] . '_recurring_fee_ops';
if (function_exists($callback)) {
$ops = $callback('user', $fee);
}
// Add the row to the table for display.
$rows[] = array(
l($fee['order_id'], 'user/' . $uid . '/order/' . $fee['order_id']),
uc_price($fee['fee_amount'], $context),
array(
'data' => check_plain($fee['regular_interval']),
'nowrap' => 'nowrap',
),
$fee['remaining_intervals'] == 0 ? '-' : format_date($fee['next_charge'], 'small'),
$fee['remaining_intervals'],
array(
'data' => implode(' ', $ops),
'nowrap' => 'nowrap',
),
);
}
// Only display the table if fees were found.
if (count($rows) > 0) {
$output = theme('table', $header, $rows);
}
return $output;
}