Active
Project:
Scribd field
Version:
6.x-1.1-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 May 2011 at 13:52 UTC
Updated:
25 Jan 2012 at 20:19 UTC
Jump to comment: Most recent file
A couple things I noticed in testing out the beta:
If you check "Make uploaded file public" and save, the file is made public in Scribd. However, that checkbox doesn't check the value when displaying: if you edit that same node, the box will be unchecked.
If you then re-check the public box and re-save, the file is re-uploaded to Scribd as a new file (like in #1135740: File uploaded to Scribd on every node edit
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1146798-2.patch | 2.2 KB | BrockBoland |
| #1 | 1146798-1.patch | 429 bytes | BrockBoland |
Comments
Comment #1
BrockBoland commentedPatch for the first part is attached: it will set the checkbox based on the stored public flag.
Comment #2
BrockBoland commentedThe attached patch does not work, but it's a start.
I added a function to change the access flag on the document in Scribd, but it's not working correctly. In
_scribdfield_node_presave(), it checks$field_value['data']['scribd_doc_id']to see if the doc has already been uploaded. However, at this point in the execution,$field_value['data']only has one value (description). Sincescribd_doc_idis never set at this point, it goes through the upload routine on every node edit.So, it's still uploading duplicate copies of the file, but before I fixed the persistence on the "Make uploaded file public" flag in the previous patch, it looked like it was working correctly. Without that fix, the "public" check box is unchecked every time you edit the node. The file is still being re-uploaded on every save, but because it's marked private, it doesn't appear in the file list on Scribd, so it only appears to be working correctly. I confirmed this by unchecking the public flag and re-saving the node a few times: the
scribd_doc_idstored in the DB changed on each save.In summary, the condition at the beginning of
_scribdfield_node_presave()needs to be fixed. It still needs to check if the file already exists on Scribd, but$field_value['data']['scribd_doc_id']is unavailable. I'm not sure how to get around this. Maybe the info from the$field_value['data']array can be added to the form as hidden elements or something like that, so that the values are available during presave.Comment #3
BrockBoland commentedAnybody else been dealing with this issue?
Comment #4
chefarov commentedI have the same issue, successfully applied path #2(1146798-2.patch) and now after I save my node I get:
The public/private flag for the document could not be set on Scribd.com.If I Edit again my node the flag is properly applied.
I can't find any relevant option in scribd.com. Also I DONT have enabled any of
"
API secret:
Use secure, non-downloadable, Scribd files.
Disable printing for Scribd files, requires secure files and API key.
"
Is this an issue of the module?
Comment #5
BrockBoland commentedThis issue is closed, but for those still using 6.x-1.0 that want a solution to this problem:
In
scribdfield_nodeapi(), thedataarray on the field is not populated with existing information about the Scribd document. Before uploading the file to Scribd, this function tries to check if the file already has a Scribd document ID (empty($node->{$node_key}[$field_delta]['data']['scribd_doc_id'])). However, since thedataarray isn't populated,scribd_doc_idis always empty, so the file is uploaded on every node save.I'm not sure where the module maintainer is going with this (see #1146798: "Make uploaded file public" flag not working correctly on node edit), but hacked in a fix for my site. I added this when looping over the fields
Existing code in
scribdfield_nodeapi():My code goes between those two lines, to load information about existing files into the
dataarray so that it's available to be checked in theifstatement: