Using views 3 alpha 2. I have a simple test view with a Node: Referrers relationship defined, and I'm getting this error when I try to preview or display the view:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND node2.delta = 1 INNER JOIN node node_node ON node2.nid = node_node.nid ' at line 3 query: SELECT COUNT(*) FROM (SELECT node.title AS node_title FROM node node LEFT JOIN content_ node2 ON node.nid = node2. AND node2.delta = 1 INNER JOIN node node_node ON node2.nid = node_node.nid ) count_alias in /srv/www/pixeledmemories.com/public_html/sites/all/modules/drupal-contrib/views/plugins/views_plugin_pager.inc on line 134.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND node2.delta = 1 INNER JOIN node node_node ON node2.nid = node_node.nid ' at line 3 query: SELECT node.title AS node_title FROM node node LEFT JOIN content_ node2 ON node.nid = node2. AND node2.delta = 1 INNER JOIN node node_node ON node2.nid = node_node.nid LIMIT 0, 10 in /srv/www/pixeledmemories.com/public_html/sites/all/modules/drupal-contrib/views/plugins/views_plugin_query_default.inc on line 1093.
I'm not an SQL expert, but I think this is error may be caused by the fact that when I edit the node referrer relationship, and click "save", the "Using Field:" value is NOT saved, which I'm thinking must be related to this issue?
If I'm wrong about this, then this issue title should obviously be changed. Anyone know what's going on here? Help is much appreciated!
| Comment | File | Size | Author |
|---|---|---|---|
| #45 | page-referrers-views-d6.txt | 4.47 KB | WorldFallz |
| #41 | backlinks_export.txt | 4.74 KB | asb |
| #25 | 716640-views-3-integration.patch | 3.28 KB | codi |
| #16 | nodereferrer_relationship_options_definition.patch | 471 bytes | PeteS |
| #14 | nodereferrer_relationship_options_definition.patch | 475 bytes | PeteS |
Comments
Comment #1
andypostSuppose option_definition() is only change that already in.
Glad to hear more opinions about compatibility
Comment #2
jordanmagnuson commentedSorry Andy, can you clarify your post?
Anyone else having trouble with this?
And sorry, I linked to the wrong "related" issue above. What I meant to link to was Views does not save certain fields or filters in Alpha 2.
Comment #3
andypost@davidlerin I just gather opinions because it's alpha, when I found a time I'll check compatibility by myself
Comment #4
jordanmagnuson commentedThanks Andrey. I do believe this has something to do with the necessity of using option_definition(), as you pointed out (and is pointed out at here), but I'm not sure where exactly things need to be fixed... could you point me in the right direction? Is it just nodereferrer_view_handler_relationship.inc that needs to be updated, or do all the node_referrer views inc files need to be changed?
Comment #5
sotiris commentedSame problem i can't use node referrer in views 6.x-3.0-alpha2. I have same errors as davidlerin...
Comment #6
jaguar_arx commentedI fixed this for myself by replacing line 23 in file 'nodereferrer_view_handler_relationship.inc'
- $options['referrer_field'] = array();
+ $options['referrer_field'] = array('default' => '');
I hope this will help.
Comment #7
andypost@jaguar_arx Thanx a lot! fixed in latest dev - http://drupal.org/cvs?commit=347888
Comment #8
sotiris commentedI can't use nodereferrer with latest Views 6.x-3.0-alpha2.
I am trying to add fields like Nodereferrer: by node type or Nodereferrer: by field, but every time i am trying to alter options like formatter, using field, display as, nothing is saved.
For example i change formatter to Node Count and hit Update, but my view doesn't change, if i go back to see formatter options for my field, selection has reset again to Node title link (default). I have tha same problem for every option nodereferrer fields.
Using CCK 6.x-2.x-dev (2010-Jan-26) and NodeReferrer 6.x-1.x-dev (2010-Mar-30).
Comment #9
andypost@sotiris thanx for review, I have no views3 on my dev-server so cant debug this. Let's wait for other reviews and patches
Comment #10
NIGHTLIFE chap commentedI have this SQL error on every node page (view & edit) of my site:
"SELECT
DISTINCT node.nid AS nid,
node.title AS node_title,
node.language AS node_language,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN content_ node2 ON node.nid = node2.
LEFT JOIN node node_node ON node2.nid = node_node.nid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE node.nid =123456"
Using:
Views 6.x-2.8
Node Referrer 6.x-1.0-rc1
...any help/suggestion/patch would be greatly appreciated.
tx
Comment #11
spelcheck commentedIt's looking like when setting NodeReferrer Argument by field, Views3 beta4 doesn't like saving those values. Anyone check me on this?
Comment #12
PeteS commentedYes, the issue here seems to be similar to problems in several other modules where Views is ignoring an option field either because of a missing option_definition() function or because of what that function is returning.
In this case, with the entry for referrer_field, it apparently doesn't like a '' value. I replaced this line in nodereferrer/views/nodereferrer_view_handler_relationship.inc:
$options['referrer_field'] = '';with
$options['referrer_field'] = array('default' => 'none');and now the field saves and my View works.
Some basic validation on both ends would be nice so that, 1., if a field isn't saved, it isn't just thrown out without any indication of an error (Views), and 2., if the referrer field isn't available for whatever reason, it doesn't allow a View to be constructed passing in blank field names (Node Referrer). But alas, sanity checks are not the Drupal way...
Comment #13
andypost@PeteS can you provide a patch?
Comment #14
PeteS commentedMaybe... let me know if I did this correctly.
Comment #15
andypostGreat, but I think that value should be '' not 'none'
Comment #16
PeteS commentedIndeed. Here's the revised patch.
Comment #17
andypostNow let's gather some reviews from community because I'm not using views 3 for now
Comment #18
henrijs.seso commentedthis is a review from community ;) no, patch not working. As I understand -dev version is already pached but arguments and filters still does not save checkbox values of fields. Must be some other change in views 3. Actually I downgraded to views 2 for testing, checked and saved, upgraded to views 3 and checked values are saved, but i guess thats not a workflow to suggest users :)
Comment #19
andypost@mansspams Are you applied a patch #16?
Comment #20
henrijs.seso commentedlatest -dev version already has these changes commited, so patch makes no change.
Comment #21
andypostSeems everything works with current views-3-dev
Comment #23
codi commentedSorry to re-open this ticket, but it seems it's not working again. I've tried with the rc2 and the dev branches of nodereferrer against views 3 dev branch. I can add a node referrer field and set it's options, but they never save and the query seems to use the defaults from the nodereferrer module.
I'll try taking a look at it, but not sure how far i'll be able to get. If anyone has any tips feel free to post 'em.
Comment #24
codi commentedSorry to re-open this ticket, but it seems it's not working again. I've tried with the rc2 and the dev branches of nodereferrer against views 3 dev branch. I can add a node referrer field and set it's options, but they never save and the query seems to use the defaults from the nodereferrer module.
I'll try taking a look at it, but not sure how far i'll be able to get. If anyone has any tips feel free to post 'em.
Comment #25
codi commentedOk, got a patch to get nodereferrer working for my use case. Not sure how much more needs to be done for other use cases, but this should help someone somewhere with views 3 compatibility.
Tested against the dev version of both nodereferrer and views 3. Not tested against views 2.
Comment #26
mattcasey commentedcodi's patch at least makes it possible to save changes to the Nodereferrer 'by field' Views field, though I'm still getting an empty field - but I'm not sure if it's a Views 3 issue or not :/
Comment #27
andypost@mattwad Are testing #25 against views 2?
As I see this is a main change of the patch, only need to test this with views 2
Powered by Dreditor.
Comment #28
mattcasey commentedViews 3
Comment #29
summit commentedHi, On views 3 latest .dev I did add the patch from http://drupal.org/node/716640#comment-3632820, but I still got exactly the same error as start of this thread:
Thanks a lot for your effort in this!
greetings, Martijn
Comment #30
asb commentedSorry, I'm a bit confused. I'm using the current views-6.x-3.x-dev, and basically stopped working completely, at least in my use cases. However, I havn't yet started to patch CCK as suggested in #700080: Views does not save certain fields or filters in Views 3, still running cck-6.x-2.9 and nodereferrer-6.x-1.0-rc2.
The patch from #25 does not apply in the described environment when running from within the "nodereferrer" module's directory:
Next I updated to nodereferrer-6.x-1.x-dev from 2011-Oct-01 which failed to apply as well with
git apply. It works better with the plain oldpatchand the-p0option:I'm now able to save the settings for a "Node: Nodereferrer: by node type" field. However, no field value is shown in the View. Summary, almost 10 months after the last posting:
Also many thanks to everybody helping to get nodereferrer working on Views 3!
Comment #31
deggertsen commentedThe patch in #25 worked for me as stated in the previous post. Very much appreciated.
Comment #32
asb commentedCurrent status: views-6.x-3.0 plus nodereferrer-6.x-1.x-dev plus the patch from #25 does not work for me as described in #26: Field values are not being saved (e.g. argument on "Node: Nodereferrer: by node type"). Is this still working for someone?
Comment #33
asb commentedAnyone?
Comment #34
asb commentedJust for the record: Views 3 now has been marked as recommended release for Drupal 6, and this module is still totally incompatible with this Views release. This issue runs for over two years, and the last comment from the maintainer is about 1.5 years old. So is thus just another abandoned "mission critical" module? Has anyone already found an alternative that works with Views 3?
Comment #35
deggertsen commentedTime to migrate to Drupal 7. Use http://drupal.org/project/entityreference instead of this module. That's my solution...
Comment #36
andypostI think #25 needs re-roll and manual testing for compatibility with views 2
Comment #37
ec commentedHi,
I just applied the patch in #25 on the april, 2012 -dev version of nodereferrer and it works as described in the second part of #30 by @asb. I'm running the last -dev version of views 3.
To sum it up, the above mentioned patch fixes the issue with the "argument on Node: Nodereferrer: by node type" not saved.
Thanks to @codi for helping with this issue.
Regards,
Comment #38
WorldFallz commentedFYI, this isn't even necessary. You can get referrers without this module using views directly: http://drupal.org/node/259837#comment-1162961
Comment #39
asb commented@WorldFallz: I'm not sure I'm understanding you correctly. The post you are referencing uses a relationship on a CCK node reference field and an argument on the node ID; if you use that relationship on a field, e.g. the node title, you get the node reference itself, not the back reference. That is redundant since this node already has exactly this data in the node reference field. What we are discussing here are inverse node references, that are those nodes that point from the node reference target back to the node reference source. You don't get this with a relationship in Views 3 on D6, imho.
Also, the 'NodeReferrer' module gives us a lot more than just backlinks, at least in Views 2; e.g. it does some king of grouping (number of back references), and it allows to list back references by content type. If you try to mimic this with vanilla Views, you'll end up with very complex or even multi-step Views, and I doubt that you will be very happy with the results as GROUP BY has tons of pitfalls in Views 3.
Comment #40
WorldFallz commentedYou should try it rather than depend on the o in 'imho', lol. Create a block view and place it on the same page as a node with a nodereferrer field-- they should yield the same results (though the view will be infinitely more configurable without having to use custom code/template files).
And I realize that nodereferrer module's views integration provides ostensibly more configuration through the ui (which was/is not working either iirc), but that's only provided it's kept functional and up-to-date. imo a basic working version of a particular functionality that doesn't rely on anything but a 'standard' and well maintained module such as views is far more valuable than a more elaborate one if the module is edge case and not kept functional and up-to-date.
Once I learned the way to create this view as described in the comment I linked, I stopped using nodereferrer and haven't found anything that couldn't be done with plain old views and some occasional theming.
In any case, I was just letting folks in this thread know that they didn't have to wait for this to be fixed to get back references. If you prefer to wait around for a bug fix by all means do, no one is trying to stop you, lol.
Comment #41
asb commentedWhat I wrote in #39 is not an opinion; I tried to follow that recipe before posting, and the "imho" is just there to indicate that one of us might be in error (I might have built the View incorrect, or you might understand something different as a backlink/node referrer/reverse node reference). If you are still convinced, that vanilla Views can mimic 'NodeReferrer', many of us will be happy to learn about it.
Attaching my exported View, based on #259837. Example use case: NID 42782 and NID 41939 (content type B) are referencing to NID 5302 (content type A). If you enter 42782 or 41939 as argument into the View, it returns node/5302. What I want are the nodes pointing back to 5302 which I don't get with this View. Another check: Take NID 5302 as argument; since NID 42782 and NID 41939 reference to this node, a proper backlink View should list those; however, the View returns empty.
Comment #42
WorldFallz commentedit's definitely possible we are missing each other-- my brain is constantly spasmed when discussing nodereferences/nodereferrers and backlinks, lol.
All I know is I have a view, created exactly as defined on the comment I linked above, that outputs exactly the same list of nodes that a nodereferrer field on the same node does-- which is technically considered a 'back link' of the other I don't know, lol.
And it's not like I've only done it the one time-- I've used that view to replace all nodereferrer fields (along with views_attach, viewfield, or eva) I was using previously. I'll see if I can make some time to pull together a generic view to post here so we can compare.
Comment #43
asb commentedThanks, that would be cool!
Comment #44
asb commentedIs there any progress in supporting Views 3?
Comment #45
WorldFallz commentedI've pretty much moved to d7/views3 exclusively, but here's an export of the view i was using for this for d6. It uses the Page and Story content types with a node reference field named "field_page_reference" on the story content type that refers to Pages.
Comment #46
asb commented@#45: Thanks for the export. As I said in #39, you'd need one extra view per field if you want to mimic what NodeReferrer delivers by default (if it's working on Views 2). E.g. try to output the number of back references, for example episodes in a season of a tv series: With the approach from #45, you need a whole View to get this single number ("22 episodes"), and additionally you have to get this into another View (that one where you actually need that number). With NodeReferrer, you simpy set up one View and configure as many fields as you like ("this season has 22 episodes, it was reviewed 14 times and the DVD is owned by 5 users"). 1 Views vs. 4 Views in this simple example. In real-world use cases, you'll quickly end up with dozends of Views to accomplish what NodeReferrer does in one.