When nodes are being generated programatically (eg when using the Feeds module to generate nodes from an RSS feed), the default site license is not being attached to them, even when they are of a content type that should get a CC license.

Comments

awjrichards’s picture

I created a patch to remedy the issue - patched against 6.x-1.x-dev from CVS

awjrichards’s picture

Status: Active » Needs review
toemaz’s picture

Good catch! Although I didn't test it yet, it does look good.

balleyne’s picture

Thanks for the patch!

I took a look at it last night. It looks good, but one question comes to mind: user defaults.

The module has a feature whereby a user might select their own default licence to override the site defaults. This patch would apply the site default regardless of any user defaults... but I'm not sure if that's actually an issue.

Do you think there are cases where a user might use some tool to generate nodes, and then want their personal defaults to be applied? Or do you think it makes sense just to use the site default here, assuming it's really the system that's creating the nodes (as is the case with your Feed module example)?

Curious to hear your thoughts before applying the patch.

(ps in the long run, I'd like to have licence detection functionality, whereby the CC and Feeds module might be able to work together to detect CC metadata in content that's being "imported" (or uploaded, in other cases) from somewhere else, but that's a mostly separate issue for future versions of the module...)

toemaz’s picture

@balleyne Indeed, I looked over the user defaults. That should come definitely before the site default.

awjrichards’s picture

@balleyne I think you're right, I didn't think about that - it's definitely possible that a user could be somehow programatically creating nodes (eg with Feeds). I think this just needs another elseif clause to check for the user default. I'll try to update this later today unless someone else wants to take a stab!

balleyne’s picture

Status: Needs review » Needs work

@awjrichards Yeah, another elseif clause could do it, or we could put that get-the-default-license-or-user-default-if-there-is-one elseif into a method of it's own, because that check is occurring in the licence selection form logic as well.

I don't mind making the change, but I might not get to it until next week. If you get a chance to update it today, go for it, otherwise I'll take care of things in a few days.

turadg’s picture

Anyone willing to fix this one this week or next for a 1.0 release?

toemaz’s picture

Assigned: Unassigned » toemaz

I'm on it for the moment.

toemaz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.49 KB

Find attached. Not tested!

kreynen’s picture

StatusFileSize
new1.8 KB

There is something wrong with the patch in #10

(Stripping trailing CRs from patch.)
patching file creativecommons.module
patch: **** malformed patch at line 42: }

I manually applied the changes and rerolled the patch. I would really like to get this into the 1.0 release, but this needs more testing.

awjrichards’s picture

Status: Needs review » Reviewed & tested by the community

This patch appears to be working nicely. Tested with drush generate-content.

First, I set up a new Drupal environment, enable three CC license schemes. Chose one to be the site default, set up a second user and selected a different license for that user's default.

To test that site defaults were being honored:

drush generate-content 10 0

This showed the expected CC license on the nodes.

To test the user defaults were being honored, I set up a test user (if you're testing along, be sure to set appropriate user permissions), applied a different default CC license for that user (relative to the site default) and ran:

drush --u=3 generate-content 10 0

This showed the expected CC license on the nodes.

kreynen’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.