Hello,

I wanted to limit users to only adding images to their own gallery, and gave them permissions as such and it was working. However, when users would edit their pictures to add captions, the "galleries" drop down list would only display -none-, therefore if they save that caption the image will be put into the -none- gallery.

I have since tried to give them all node gallery related permissions, but still the drop down only shows them -none-. For my administrator user, I can see all galleries in that list.

I would be happy to hear what I may have missed? I am using pretty much all default settings as I have only recently begun using node gallery. Are there any other non-node gallery permissions that are necessary?

Best regards,
Ao

CommentFileSizeAuthor
#15 node_gallery_node_access_bypass.patch1.95 KBj.lucky
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fluxrider’s picture

I dont think you've missed anything in permissions. The only way to open that list out of the box is by allowing administer access and obviously that cant happen. Editing a node gallery page for caption or some such leaves the item orphaned from the original gallery. I had a fiddle with the widget and entity reference but know getting php notices everywhere , so starting again.

fluxrider’s picture

Hi Ao
I'm using 7.1.beta3.
A workaround for this so you get a list of galleries to drop down for the user is to go to the gallery item > manage fields where you will see the field galleries. Open the 'edit' tab and down there under ' entity selection ' you'll see ' node gallery ' selected . Change that to ' simple ( with optional filter by bundle) ' and that will expose the content type list. Check 'Gallery' and that will give the user the drop down list.
The list should ideally default to blank so the choice can be made required so i'm looking into that - and also a way of limiting to the user to their own galleries - testing this soon, but for now this at the least doesn't orphan the picture from its parent gallery.

fluxrider’s picture

Sorry. the above setup is giving me problems adding new galleries. Pictures are not showing. ::sigh::. back to fiddling...

fluxrider’s picture

I've been chasing this all over the place. I found this issue also in entity reference module and that led to a bug in Entity API HERE so tomorrow I'll be testing a patch or two on entity api to see if it solves this problem here.
I am now using the latest dev versions of these modules ( including node gallery) . Is anyone else having this issue ? I just find it hard to believe that if authenticated users can't edit their pictures on the node display page your all okay with that - or is there some other solution I'm missing ? Anyhoo, I'm patching after some sleep and will let this thread know.

Aonoa’s picture

Thank you very much for your work on this so far, fluxrider. I appreciate it and am looking forward to possible solutions and input from others as well. :-)

Best regards,
Ao

fluxrider’s picture

Version: 7.x-1.0-unstable3 » 7.x-1.x-dev
Component: User interface » Code
Category: support » bug

Hi Ao . Hope you dont mind but I've changed the version of your OP to the latest dev version and listed it as a bug which I think it is. It totally stops User galleries because the only way 'out of the box' to allow users to edit the node edit page i.e. the page displayed using 'node item display' is to give the user Bypass content access control permission which gives users unfettered rights on all site content so thats simply not a choice.
Best part for me in all this is I'm learning heaps about entities and fields tryng to find a solution, and discovering its a common problem around the neighbourhood.
node_gallery_ref_1 , the field in question could maybe be 'hidden' from the node edit page which might solve the problem. First thing I guess is study the code of the api.

fluxrider’s picture

Priority: Normal » Major
rocbrook’s picture

I'm building a photo contest, where users can add photos to galleries while these galleries are active (I created a boolean status field for this), once the gallery expires I don't want it to show in the drop down anymore. For this it's easy to do by creating a view to filter the entities referenced. HOWEVER, if the default Node Gallery entity selector isn't used, then the photos never get added to their respective galleries. Even though they show up in the drop down and are selected. If possible, instead of the Node Gallery default option, it would be nice to have a customizable view.

rocbrook’s picture

Found a solution and it works for me. I simply added a line of code to the file
/sites/all/modules/node_gallery/plugins/entityreference/selection/NodeGallerySelectionHandler.class

line 51 where it says:
$query->entityCondition('entity_type', $this->field['settings']['target_type'])

change to:
$query->entityCondition('entity_type', $this->field['settings']['target_type'])
->fieldCondition('field_status', 'value', 1);

I'm not much of a coder but if you create a "fieldCondition" to take into account that it's the users own album you should be set.

Keep in mind that you're modifying the core module, so whenever there's an update and you apply it you will probably loose these changes. There might be a way to create a file in your theme folder to override this.

nick2006’s picture

@rocbrook:It does not work for me or I did wrong. Can you explain more? Is there no other way?

sassafrass’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta3

#2 worked for me. Thank-you for the suggestion!

fugazi’s picture

I can not access my galleries as a user. About premission I can set admin can access. But users should be able to access at least to their own galleries.

Gallery can be created images can be uploaded via plubload in gallery. When should only be added gallery-image, no gallery will appear.

It is very important for my community and the members can upload images in your own gallery. It is not good when getting new gallery must be created.

Are opportunities already been found. I'm using the latest DEV 10/12/2013

Screenshot 1

Screenshot 2

fugazi’s picture

there may already approaches what it can lie. Did I perhaps what set incorrectly. I appreciate any help, hint, encouraging very grateful.

fugazi’s picture

really know any, what it can lie. I can not even uninstall the module, because I have 7000 pictures in 900 galleries. otherwise I would do it, but I can not afterwards recover galleries and pictures. help!

j.lucky’s picture

Issue summary: View changes
FileSize
1.95 KB

Thanks @rocbrook for your suggestion.

I found a work arround for this issue, as the problem was with unexpected behaviour of node_access, we bypassed this by using DANGEROUS_ACCESS_CHECK_OPT_OUT .

I am attaching patch for the same.

Cheers :)

fraweg’s picture

Hi j.lucky,

you safe my day with this patch! Together with field permission users can edit the Node gallery image but, not change the reference. Exact what I am searching for!

Thanks a lot!!!
Best regards
Frank

fugazi’s picture

the plugin works very well, only every member can move pictures in each gallery. I need it, the only members see their own galleries. At 2000 members it is not good that she can move pictures in each gallery. Is there already a solution for this.

best Regards
Patrick

fraweg’s picture

Hi fugazi,

you can do this with views. You can filter all images or galleries by users. For that you can use contectual filter by autor uid us set the default value to the logged in user.

Best regards
Frank

fugazi’s picture

Hello Frank,

many thanks for the tip. I'm not so good with views, I need to create or do I need the existing tree of node gallery using a new views.

fraweg’s picture

Hi fugazi,

in the views you have to edit gallery item view. There is an advanced option in the view. In this field you can add a contextual filter. Here you have to add a field (content -> author uid) and set the default value "url from logged in user". After that the gallery should filtered by the logged in user. Maybe this links help:

https://drupal.org/node/1578564
http://www.youtube.com/results?search_query=Drupal+7+Views+Module+Tutori...

If you want to work with drupal you really should lean how to use views.

I think if you have more questions you should open a seperate support issue.

Best regards
Frank

kenorb’s picture

Status: Active » Needs review