From 07be282def4987c449801a1b85b1d8c75d1859b9 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 30 Apr 2017 18:40:42 -0500 Subject: [PATCH] Send to GitHub. --- ubercart_order_hide.info | 6 ++++++ ubercart_order_hide.module | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 ubercart_order_hide.info create mode 100644 ubercart_order_hide.module diff --git a/ubercart_order_hide.info b/ubercart_order_hide.info new file mode 100644 index 0000000..1cbfe1e --- /dev/null +++ b/ubercart_order_hide.info @@ -0,0 +1,6 @@ +name = Ubercart Order Hide +description = Hide Ubercart order details from people who shouldn't see them Custom module installed by MBK. +package = Other +core = 7.x + +files[] = ubercart_order_hide.module diff --git a/ubercart_order_hide.module b/ubercart_order_hide.module new file mode 100644 index 0000000..ef0f3d8 --- /dev/null +++ b/ubercart_order_hide.module @@ -0,0 +1,38 @@ + array('administrator', 'editor'), + ); + $path_alias = drupal_get_path_alias($_GET['q']); + global $user; + foreach ($restrictions as $path => $roles) { + // See if the current path matches any of the patterns provided. + if (drupal_match_path($path_alias, $path)) { + // It matches, check the current user has any of the required roles + $valid = FALSE; + foreach ($roles as $role) { + if (in_array($role, $user->roles)) { + $valid = TRUE; + break; + } + } + if (!$valid) { + drupal_goto('access-denied'); // Or whatever the URL is for your site's access denied/403 page. + } + } + } +} +?> \ No newline at end of file