You are here

function uc_recurring_user_access in UC Recurring Payments and Subscriptions 6

Same name and namespace in other branches
  1. 6.2 uc_recurring.module \uc_recurring_user_access()
  2. 7.2 uc_recurring.module \uc_recurring_user_access()
1 string reference to 'uc_recurring_user_access'
uc_recurring_menu in ./uc_recurring.module
Implementation of hook_menu().

File

./uc_recurring.module, line 94
Allows you to add a recurring fee to a product/SKU to handle subscription type services.

Code

function uc_recurring_user_access($account, $rfid) {
  global $user;

  // Let administrators do whatever they want.
  if (user_access('administer recurring fees')) {
    return TRUE;
  }

  // Users can only access forms for their own recurring fees through their own
  // user account.
  $fee_uid = db_result(db_query("SELECT uid FROM {uc_recurring_users} WHERE rfid = %d", $rfid));
  if ($user->uid != $account->uid || $account->uid != $fee_uid) {
    return FALSE;
  }
  return TRUE;
}