I am attempting to create a view with a list of users who have completed a particular Content Type form, but the sql that is output appears to be using the wrong field to create the join.

Create a new view of type "User"
Add two fields : User:Uid and User:Name
Add a relationship to "User: Nodes authored"

The resulting sql has the following syntax:

SELECT DISTINCT(users.uid) AS uid_1,
users.uid AS uid,
users.name AS users_name
 FROM users users 
 LEFT JOIN node node_users ON users.uid = node_users.nid
  GROUP BY uid

Should the join not be

 LEFT JOIN node node_users ON users.uid = node_users.uid

?

Dawson

Comments

DementedManiac’s picture

I guess I must have raised this in the wrong place as it's been ignored. Anyhow, after a bit of experimentation, I've got it working by adding
'base field' => 'uid',
to views\modules\user.views.inc on line 70.

I don't know if this has caused other problems or not.

dawehner’s picture

Status: Active » Fixed

I don't undestand how this could be a drupal core issue. I will answer in the views issue, too.

DementedManiac’s picture

I'm sorry, but I'm unclear what has happened here. You've stated that is not a drupal core issue, which I agree, as I stated above that I had put this in the wrong place. I'm sorry for not at first figuring out HOW to log it against the right module, but then you've gone and marked this one as fixed - nothing's been fixed, I just put in a hack to my local copy which works for me, but may well break other things, I don't know, and you marked the other thread as a duplicate.

It appears to me that by doing this, no one who is working on the Views project will see the issue and so it will go on ignored, and unfixed. Would it not be a better move to mark THIS thread as a duplicate, and leave the other alone until someone working on the Views project can verify the issue?

If I've got this all wrong, I'm sorry, I'm new to drupal, and once I fixed my own version I just wanted to share what I'd found in the hope that it can help others, and if my fix is right, then get it rolled into the project so that a future update doesn't undo my patch.

Dawson

dawehner’s picture

I put the other issue on duplicate. That's the real state.

It appears to me that by doing this, no one who is working on the Views project will see the issue and so it will go on ignored, and unfixed. Would it not be a better move to mark THIS thread as a duplicate, and leave the other alone until someone working on the Views project can verify the issue?

As i say, the other issue is a duplicate of another issue. On this another issue is a patch which works. Just use this patch.

I think your patch does the same as earl ones.

DementedManiac’s picture

Now I understand. Sorry for the confusion, and thanks for the pointers.

Dawson

Status: Fixed » Closed (fixed)

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