aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muamba.db.inc13
1 files changed, 11 insertions, 2 deletions
diff --git a/muamba.db.inc b/muamba.db.inc
index f06e3be..1c1894e 100644
--- a/muamba.db.inc
+++ b/muamba.db.inc
@@ -169,10 +169,16 @@ function muamba_current_transactions($data, $uid = NULL) {
* @param $data
* Item nid or node object.
*
+ * @param $uid
+ * Optional uid parameter to check if item is currently
+ * available to the user.
+ *
* @return
- * TRUE if item is borrowed, FALSE otherwise.
+ * TRUE if item is available, FALSE otherwise.
*/
-function muamba_check_availability($data) {
+function muamba_check_availability($data, $uid = NULL) {
+ global $user;
+
if (is_object($data)) {
$nid = (int) $data->nid;
}
@@ -193,6 +199,9 @@ function muamba_check_availability($data) {
if (empty($current)) {
return TRUE;
}
+ elseif ($uid !== NULL && $current['uid'] == $user->uid) {
+ return TRUE;
+ }
return FALSE;
}