? .DS_Store
? 0001-fixing-some-notices_0.patch
? cc_custom_message.patch
? creativecommons-user-default.patch
? creativecommons-user-default2.patch
? example.patch
? images/.DS_Store
? images/buttons/.DS_Store
Index: creativecommons.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/creativecommons/creativecommons.module,v
retrieving revision 1.9.2.83
diff -u -p -r1.9.2.83 creativecommons.module
--- creativecommons.module	11 Aug 2010 16:33:47 -0000	1.9.2.83
+++ creativecommons.module	12 Aug 2010 03:07:35 -0000
@@ -1970,10 +1970,31 @@ function creativecommons_save($node, $op
     $cc_license_uri = $node->creativecommons['select_license_form']['cc_license_uri'];
     $metadata = $node->creativecommons['metadata'];
   }
-  else {
+  elseif (!empty($node->cc)) {
     $cc_license_uri = $node->cc->uri;
     $metadata = $node->cc->metadata;
   }
+  // Fallback to the default user or site license
+  else {
+    // Retrieve the account of the node owner
+    if ($user->uid == $node->uid) { 
+          $account = $user;
+    }
+    else {
+      $account = user_load(array('uid' => $node->uid));
+    }
+    // Test whether user has permissions to set his default license
+    if (user_access('use creative commons user defaults', $account)) {
+      $cc_license_uri = $account->cc->uri;
+      $metadata = $account->cc->metadata;
+    }
+    // Fallback to the default site license
+    elseif (creativecommons_node_type_is_enabled($node->type)) {
+      $default_license = creativecommons_get_default_license();
+      $cc_license_uri = $default_license->uri;
+      $metadata = $default_license->metadata;
+    }
+  }
   
   // check that licensing is enabled for the content type and at least on license is enabled to
   // avoid errors on new installs
