Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Node Reference URL Widget is not compatible with OG 7.x-2.x-dev:
Fatal error: Call to undefined function og_get_context_by_url() in /***/nodereference_url/nodereference_url.module on line 178
Drupal 7.12
OG 7.x-2.x-dev
Comment | File | Size | Author |
---|---|---|---|
#17 | nodereference_url-og_72_compatibility-1514180-16.patch | 842 bytes | thomas.fleming |
#10 | nodereference_url-compatibility-with-og-2-1514180-7003030.patch | 850 bytes | Open Social |
Comments
Comment #1
iRex CreditAttribution: iRex commentedalso getting the same problem. anybody found a work around?
thanx!
Comment #2
dtarc CreditAttribution: dtarc commentedThe way OG 7.x-2.x is set up I don't think there's going to be an easy way to do this. However I don't think this code will work with OG 7.x-1.x either, as og_get_context_by_url() does not appear to be in there either.
The issue is that OG 7 uses EntityReference to make the group field, and it uses EntityReference Prepopulate to set the gid in the url.
Most of the time the group audience field will be called og_group_ref. Hoever, OG 7.x-2.x allows multiple group audience fields per entity, and so really these fields could have any machine name.
So I'm not sure how easy it will be for nodereference_url to automatically tack on group gids. It will require some thought, for sure.
For the project I'm using these two modules on, we aren't using the nodereference_url link autogeneration. We are using Display Suite and making custom display suite fields to display these links. For our purposes we don't need nodereference_url to know anything about og.
However even though we aren't using these auto generated links, the auto generation keeps running, and we get this fatal error. I thought of removing the og related code via a patch, but I noticed another bug.
Currently nodereference_url allows you to specify whether these links should be created for full or teaser nodes. However, even if this is set to disabled, the links get generated (causing this fatal error). You can track this issue here - #1571318: Node link settings booleans not being checked (I have added a patch with the fix).
Applying the patch linked in the above issue at least allows for turning the link generation off, eliminating the fatal error. Unfortunately you then need to come up with a custom solution to create the link yourself, if you would like the og group gid added.
Note: since OG 7.x-2.x uses EntityReference Prepopulate, this handles the setting of group gid. You don't need nodereference_url to do this. You only need to combine Nodereference URL with OG Group passing if you have a more complex use case.
Here is what we are using it for -
Node Type A is a group
Node Type B is a group post content type
Node Type C is a group post content type
Node Type C has a node reference to Node Type B
So, on Node Type B, we want a link that will load a Node Type C node add form, and autopopulate both a) the group audience field referencing to Node Type A, as well as the node reference field referencing Node Type B.
So we create custom links that look like this:
node/add/node_type_c/[node_type_b_nid]?og_group_ref=[node_type_a_nid]
Once the links are no longer being auto-generated, we are no longer having to deal with the bug.
Comment #3
Patribus CreditAttribution: Patribus commentedWas there some development for this issue?
xanks
Comment #4
ptitwolfy CreditAttribution: ptitwolfy commentedSubscribing
Comment #5
Patribus CreditAttribution: Patribus commentedHello, I'm repeating myself with this post, but again the question:
are there news concerning this subject?
Cheers
Comment #6
Oleksa-1 CreditAttribution: Oleksa-1 commentedsame issue and i think i am willing to migrate from nodereference to EntityReference to solve it.
Comment #7
Patribus CreditAttribution: Patribus commentedyes, I was thinking about the same thing... But as far as I understood it, EntityReference does not offer a fraction of the functionalities of NodeReference. Well, EntetyReference Propopulate to be more exact. The thing is, I do not really know it, since there is no real documentation for EntityReference Prepopulate (or is there one?)
Also I do not fully understand the differences between the Prepopulate and the EntityReference Prepopulate modules. Is there some place, where an overview of these modules + Node Reference URL are compared, described, etc?
Cheers
Comment #8
Oleksa-1 CreditAttribution: Oleksa-1 commentedin readme.txt
also you can enable og_example in OG 7.x-2.x-dev to see how it works.
Comment #9
Open Social CreditAttribution: Open Social commented+1 on comment #2.
I also think we should check if this function exists, because it will break your site when using OG 2.x branch..
Comment #10
Open Social CreditAttribution: Open Social commentedSee attached patch. It will not fix the problem, but at least your site will not crash.
Comment #11
ishiomin CreditAttribution: ishiomin commentedI am using Node Reference URL Widget with Answer Project . In my case, question and answer node type are group contents and users have created permission for this two type contents stricly in groups. The groups audience field is required and setting with entity reference prepopulate and with number of values illimited, a user can post a question in several groups. A user can post an answer with the url in the question if he has joined one or more groups of the question and the prepopulate answer is in the groups question subset. The code below is OK for my case :
Comment #12
bsandor CreditAttribution: bsandor commented#10 patch looks to be working for me
Comment #13
afdigital CreditAttribution: afdigital commented#10 patch works for me too. The site seems to work fine enough after applying the patch.
Comment #14
ssoulless CreditAttribution: ssoulless commentedIt works for me, but well see for production sites... if someone could fix the problem with this patch and is in a production environment please post it here, then the issue will be closed after not...
Comment #15
ssoulless CreditAttribution: ssoulless commentedI already use the patch in a production site, the maintainers should comit it. Now the issue can be closed
Comment #16
thomas.fleming CreditAttribution: thomas.fleming commentedI agree that this patch needs to be committed, but it also needs to be tested first. Setting to needs review for testing.
Comment #17
thomas.fleming CreditAttribution: thomas.fleming commentedSince Organic Groups 7.x-1.x isn't a supported release anymore, I created a new patch that should make Node Reference URL Widget compatible with Organic Groups 7.x-2.x.
Comment #18
ssoulless CreditAttribution: ssoulless commentedTested in my dev site, Not sure what can happen, in a production site, how ever it should works fine in a production site too...
Thanks for the patch tidrif
Comment #19
ggevalt CreditAttribution: ggevalt commentedHave to say that it's very sad that this module is not working right. Since we are using OG, it does not play well. Basically it breaks the parent content type. I appreciate the effort with the patch, but it so far looks untested and we can't take a chance.
The references and node reference url widget worked really well in D6. We used it in all are sites for several different functionalities and it is a shame to have lost it. We now have to move to D7. Entity reference and Entity reference prepopuate don't do the same thing and folks' suggestions on how to emulate the Node Reference URL widget, while well meaning, would have made Rube Goldberg proud -- and for those of you who don't understand that reference, Goldberg was a cartoonist who devised intricately complex machines to do a simple task.
Since we need to move forward, we are, sadly, going to have to abandon the references modules, including this one and try to fashion something that works almost as well out of the entity reference modules as this is the course of Drupal, we don't have much time left to complete our task and this fine module seems inoperative with OG.
I want to thank all of you who've put so much effort into the D6 modules. This is one of those changes that weren't for the better and it's too bad that these modules got nosed out by the D7 preference for entity references which seem far more complicated and less robust.
Thanks again for your efforts.
Comment #20
katche CreditAttribution: katche commentedhi
where exactly do i have to put in the file in patch #10?
thanks for helping!
Katharina
Comment #21
matt.rad CreditAttribution: matt.rad commentedCan we get this committed please?
Comment #22
krutibhakta CreditAttribution: krutibhakta commentedThank you patch #10 works.