You are here

function uc_coupon_purchase_can_view in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 6 uc_coupon_purchase/uc_coupon_purchase.module \uc_coupon_purchase_can_view()
  2. 7.2 uc_coupon_purchase/uc_coupon_purchase.module \uc_coupon_purchase_can_view()

Access callback for user/%/coupons.

User must have "view purchased coupons" permission, current user must have a coupon to view, other users must have "administer users" permission.

If a coupon is specified, user must have purchased that coupon.

1 call to uc_coupon_purchase_can_view()
uc_coupon_purchase_uc_coupon_actions in uc_coupon_purchase/uc_coupon_purchase.module
Implementation of hook_uc_coupon_actions for purchased coupons
1 string reference to 'uc_coupon_purchase_can_view'
uc_coupon_purchase_menu in uc_coupon_purchase/uc_coupon_purchase.module
Implements hook_menu().

File

uc_coupon_purchase/uc_coupon_purchase.module, line 68

Code

function uc_coupon_purchase_can_view($account, $coupon = NULL) {
  global $user;
  if (user_access('view purchased coupons')) {
    if (user_access('administer users') || $account->uid == $user->uid && uc_coupon_purchase_has_coupon($account, $coupon)) {
      return TRUE;
    }
  }
  return FALSE;
}