* @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;
}
if (empty($current)) {
return TRUE;
}
+ elseif ($uid !== NULL && $current['uid'] == $user->uid) {
+ return TRUE;
+ }
return FALSE;
}