When I set "publish to" option (Domain Access - http://drupal.org/project/domain) of a Node Gallery, this field is not replicated individually in each image of the gallery.
Thus, when I visit that domain, only the text appears in the gallery, but not their images.

Within Mysql it must create a record for each image within "domain_access" table (field "realm" = "domain_id")

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nienaber’s picture

Do you have a fix for this or asking if someone has a fix?

rogeriodec’s picture

No. I think anyone knew around this (at least the developers of this module) but by the way this bug will be left open.

nienaber’s picture

Are you using the pluploaded module to do the uploads for the images?

rogeriodec’s picture

Yes, why?

nienaber’s picture

With my setup the domain I am using to upload the images with is being set as the default domain. I am busy writing a module that will fix the uploads and make sure that the images have the same subdomains as the parent node. When I get it working I will share it with you. Probably next hour or two.

rogeriodec’s picture

Great!
Just to clarify, my problem is as follows:
1) I create a node gallery (title, text, etc.) assigned to domain X
2) I upload the images (pupload) and they are correctly assigned to domain X
3) At another moment, I want to add another domain (Y) to allow viewing this gallery.
4) When I edit this node, it has domains X and Y assigned, but the images remains only with domain X

nienaber’s picture

Yup, this is similar to my problem.

nienaber’s picture

So this is what I have so far. There seems to be some incompatibility with domain and plupload. For your scenario as outlines above the following code will fix the problem:

<?
module_load_include('inc', 'node_gallery', 'node_gallery');

function custom_module_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   switch($op){
   case 'presave':
      if (in_array($node->type, (array)node_gallery_get_types('image'))) {
         
         $parent_node = node_load($node->gid);
            
         $node->domains = $parent_node->domains;
         $node->subdomains= $parent_node->subdomains;
         
      
     }
    break;
}

What doesn't work is if you have changed the "publish to" to say x, y ,z and then use the pluload to add another image. It will only take the default domains. The work around for this is to simply "edit" the gallery, hit save and it will update all images to the correct domain assignment. When I figure out the problem with plupload I will post an update. I have to dig into some more of the code.
Let me know if this sorts your problem.

rogeriodec’s picture

Thank you!
Excuse my ignorance, but where will I implement this code?

nienaber’s picture

FileSize
1.51 KB

I have folded it into an independent module. This is not an official module and you use it as your own risk (just a generic disclaimer).
Drupal.org has renamed the file to node_gallery_domain.tar_.gz, just remove the "_" and unzip it in your modules folder. Enable the module and it will work right out of the box.
Let me know if it sorts your problem.

rogeriodec’s picture

I think it's not working.
I installed and activated the module, I edited a node gallery by adding a new domain in the list "to publish", but nothing changes in the nodes of the images, still with the same old domain, no new additions ...

nienaber’s picture

For what I tested the table domain_access was updated with the correct records. Not sure what the difference is with your configuration. There are still some scenarios where this module does not work and I am working on fixing that. I will update here when I have something more concrete. Sorry that quick fix didn't work for you. I will keep you posted on progress.

nienaber’s picture

FileSize
1012 bytes

I found that the plupload module was not calling the hook_node_access_records hook when it saved the image.
I hooked into hook_plupload_node_postsave and manually invoke the hook. When image nodes are being saved I retrieve its parent node domain settings and manually assign them to the node, just copying them essentially.

With my installation I have the node_gallery_taxonomy module enabled which I automatically updates all children nodes. I think that is the difference between your installation and mine. I have updated the module to batch update all its children nodes. I have updated the module here for you.

Let me know if that works for you.

rogeriodec’s picture

Thank you again for your efforts.
But I think I'm not expressing myself correctly.
The problem does NOT occur in creating the node, but in its UPDATE. So I do not see what puload has to do with it.
So if I have a gallery with 5 images then I have a total of six nodes with attribution of the original domain (1 primary node + 5 nodes of images).
Later I decide that this gallery should be exposed in another domain, addition to the current domain.
When UPDATING the gallery node, If I check an additional domain in "publish to" in the gallery node, after saving this node, it does NOT check the same domain in the other five nodes of images.

nienaber’s picture

Did you download the new version of the module I included in my most recent post? That code fixes this very issue.
Let me know.
Thanks
Wickus

zengenuity’s picture

Status: Active » Closed (fixed)