Views relationships and DA

CorpX - March 10, 2009 - 10:36
Project:Domain Access
Version:6.x-2.0-rc8
Component:- Domain Views
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:comments, domain access, views
Description

Hello! first, thx for this module; it rocked my world. I have built an admin panel that works for all domain. Its works very well as I filter the views by current domain for each node type. Each domain admin get only their content. Today, I work on implementing comments and ran into a wall.

I setup a comment view with the idea that I would show users unpublished comments for their domain. the export is posted below, but in short I did the following:

- create view type > comment
- added field > "comment body"
- create a relationship type > node
- added a filter using the node relationship > Domain: Domain ID = Current Domain

I got the follow error....
Any suggestions?

user warning: Unknown column 'domain_access.realm' in 'on clause' query: SELECT comments.cid AS cid, comments.comment AS comments_comment, comments.format AS comments_format FROM comments comments LEFT JOIN node node_comments ON comments.nid = node_comments.nid LEFT JOIN domain_access node_comments__domain_access ON node_comments.nid = node_comments__domain_access.nid INNER JOIN domain node_comments__domain ON node_comments__domain_access.gid = node_comments__domain.domain_id AND (domain_access.realm = 'domain_id') WHERE node_comments__domain.domain_id in ('0') LIMIT 0, 10 in /home/a2d/spokanetonight.com/sites/all/modules/views/includes/view.inc on line 725.

here is an export of the view...

<?php
$view
= new view;
$view->name = 'Comments';
$view->description = 'Comments';
$view->tag = 'admin';
$view->view_php = '';
$view->base_table = 'comments';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
 
'nid' => array(
   
'label' => 'Node',
   
'required' => 0,
   
'id' => 'nid',
   
'table' => 'comments',
   
'field' => 'nid',
   
'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
 
'comment' => array(
   
'id' => 'comment',
   
'table' => 'comments',
   
'field' => 'comment',
  ),
));
$handler->override_option('filters', array(
 
'domain_id' => array(
   
'operator' => 'in',
   
'value' => array(
     
'***CURRENT_DOMAIN***' => '***CURRENT_DOMAIN***',
    ),
   
'group' => '0',
   
'exposed' => FALSE,
   
'expose' => array(
     
'operator' => FALSE,
     
'label' => '',
    ),
   
'id' => 'domain_id',
   
'table' => 'domain',
   
'field' => 'domain_id',
   
'relationship' => 'nid',
  ),
));
$handler->override_option('access', array(
 
'type' => 'none',
));
$handler->override_option('style_plugin', 'table');
?>

Thanks in advance for the guidance...

#1

agentrickard - March 10, 2009 - 13:36
Version:6.x-2.0-rc5» 6.x-2.0-rc6
Category:support request» bug report

Domain Views is not finished, and probably only recognizes node tables right now.

The problem seems to be that this part of the query is not being aliased:

(domain_access.realm = 'domain_id')

Earlier, the table is defined as domain_access node_comments__domain_access, so that section should be:

(node_comments__domain_access.realm = 'domain_id')

Hopefully that will help you to patch Domain Views. If you do, please submit the patch.

See also #319876: Domain Access 6.x-2.0 and Views 2

#2

nonsie - March 10, 2009 - 17:50

This is because of the extra part in domain_views.views.inc:

  $data['domain']['table']['join']['node'] = array(
    'left_table' => 'domain_access',
    'left_field' => 'gid',
    'field' => 'domain_id',
    'type' => 'INNER',
    'extra' => "domain_access.realm = 'domain_id'",
  );

Not sure if Views already has a workaround for extra conditions not being aliased - and I haven't touched Views for a while to know if it has changed.

As Ken said, Views is not complete yet for DA:(

#3

agentrickard - March 10, 2009 - 18:09

Hm, I wonder if there is an 'alias' flag for that definition, or if it is simply malformed.

#4

mnp - April 7, 2009 - 06:20

hi corpx
iam trying to install domain access module
where to place my subdomain folder
this is my hostfile configuration

127.0.0.1 localhost
127.0.0.1 newone.localhost
127.0.0.1 web.localhost

iam creating domain record but if i click on domainview option iam getting page not found
where to place my settings.php for subdomain
please help me

#5

agentrickard - April 7, 2009 - 14:20

@manasapenchala

Please do not hijack threads.

#6

mnp - April 8, 2009 - 04:15

iam sorry agentricard
dont think bad about me my situation is very critical
i will not repeat this
i hope any one helps me

#7

agentrickard - May 25, 2009 - 17:35

Need to explore #2.

#8

agentrickard - July 27, 2009 - 00:13
Version:6.x-2.0-rc6» 6.x-2.0-rc8
Status:active» needs review

The attached patch is hopelessly tied up with #369928: Filter in Views for users from a domain but seems to work.

You will have to alter your view a bit.

AttachmentSize
397116-relationship.patch 5.19 KB

#9

nonsie - August 7, 2009 - 23:06

@agentrickard, could you post altered version of the view in #1 created after applying your patch? I'm a bit lost about the workaround here.

#10

agentrickard - August 8, 2009 - 15:40

It's bee n a while. I think this is it.

AttachmentSize
view.txt 3.38 KB

#11

agentrickard - August 22, 2009 - 22:44
Status:needs review» fixed

Committed to HEAD.

#12

System Message - September 5, 2009 - 22:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.