Closed (fixed)
Project:
Node clone
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Dec 2010 at 15:25 UTC
Updated:
9 May 2014 at 01:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jmiccolis commentedI neglected to change hook_perm -> hook_permission. That is included in this patch.
Comment #2
danielb commentedJust for the purposes of discussion, because I have faced this same problem...
The filter formats still do exist under each field at
$node->[field_key][language][n]['format']
Where field_key is the field (such as 'body'), language can be 'und', and n is the field item index.
And then the format id value retrieved from there can be plugged into filter_format_load() and the result of that passed to filter_access().
However I do not know how to get the fields of a node or get the languages available for the field, etc.. so this information is useless. I suspect there is no facility to do this other than to iterate through a node and see if any property is a field, and then to iterate through each language and item index checking for a value in 'format' which seems like a bit of a hassle.
I don't even know if it is really all that important to check this either.
You can pass the 4th argument by passing it as a variable.
Drupal 6
Drupal 7
I think that will work. There is a risk that another module can alter this. The alternative is to do:
Also the hook should probably by convention start with "node_clone" (the module short name) as should various other functions and files in this module.
Comment #3
danielb commentedJust a note, I've learnt that 'und' is actually LANGUAGE_NONE
Comment #4
will_in_wi commentedSubscribe
Comment #5
pwolanin commentedThanks for the patches - looks like the versions here need to be updated too.
The clone link should also become a contextual link and local action on the node rather than a tab.
Comment #6
xacto commentedThumbs up!!
Thanks!!
Comment #7
benanderson commentedsubscribe
Comment #8
georgedamonkey commentedsubscribe
Comment #9
pwolanin commentedThe drupal_alter() API docs suggest possibly using a a $context array to pass in additional parameters.
http://api.drupal.org/api/drupal/includes--module.inc/function/drupal_al...
Comment #10
xacto commentedShould this patch be ported to a D7 developer version?
It seems to work well enough for Dev version.
It would make updates and patches easier to track.
Could someone take care of that?
Comment #11
webankit commented+1
Comment #12
jonaswouters commentedsubscribing
Comment #13
Csabbencs commentedI'd like to have a D7 version of this module, too.
Comment #14
chipway commentedsubscribing
Comment #15
MatthijsG commentedWould like to test the Dr7 version :-)
Comment #16
spacereactor commentedsubscribing
Comment #17
xacto commentedYou can apply the last patch in this thread.
It will give you a non CVS version that works to some extent.
That patch should be ported to a new 7.x branch.
Comment #18
Anticosti commentedsubcribing
Comment #19
pwolanin commented@danielb - the module name is clone.module, hence any "hook" should correctly use "clone". The project short name just relates to repo organization.
Comment #20
pwolanin commentedLooking at the D7 handing of filter access - looks like you can now edit the node but not the individual field, so I think the patch is ok in terms of removing that check.
Comment #21
pwolanin commentedPatch in #1 was a bit incomplete. This seems to basically work.
Comment #22
pwolanin commentedcommitted this plus README updates.
Comment #24
Letharion commentedSince this issue is about D7, I guess that there was just no D7 branch when the issue was created, so I change it to 7.x-1.x-dev now.
I'm reopening this issue, because it seems like this patch is not applied to the current dev version?
I came to the issue queue in order to file a bug about the OPs first problem:
"Removed the filter_access() check against a node's format".
This patch clearly fixes this particular issue, but when I clone the repo and checkout 7.x-1.x the incorrect filter access check remains, and as such the module will never successfully clone anything.
Just to be clear about what code I'm currently using, this is the last entry in the commit log.
Since this _should_ already be fixed, I'm just reopening this and asking what has happened? I would gladly roll a new patch if that's the recommended way forward :)
Comment #25
Letharion commentedSince I wanted to use this, I just re-rolled the patch so I could test it out a bit. I've only done rudimentary testing of this, but what little I've seen works well.
Comment #26
Letharion commentedComment #27
Letharion commentedI made a mistake in hook_install.
Comment #28
pwolanin commentedThanks for the patch.
Comment #29
pwolanin commentedThanks, committed.