The protection works if the file field is directly attached to the node. If it is in i.e. a field collection, I get:

Notice: Undefined property: stdClass::$type in jplayer_protect_file_download()

CommentFileSizeAuthor
#1 field_collection_protect-2014493-1.patch723 bytesold_toby

Comments

old_toby’s picture

Status: Active » Needs review
StatusFileSize
new723 bytes

As the field is not attached to an entity type but to a field name, I included a check if an entity type is given, and if not, it takes the field_name as the context.