Closed (fixed)
Project:
Node Reference URL Widget
Version:
6.x-1.6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2009 at 19:32 UTC
Updated:
22 Oct 2010 at 09:59 UTC
Jump to comment: Most recent file
Comments
Comment #1
snorkers commentedI ran the patch and received a 'patch unexpectedly ends in middle of line' error, although the patch seemed to run by looking at the text content.
However, not sure how to structure the URL: I expected this to work, but it didn't
I also tried /node/ognodeadd/NID?type=listing&gids%5B%5D=3462
Where listing is my [OG post] content type, and NID was my node ID of the referencable content. Have I structured the URL correctly?
Comment #2
WorldFallz commentedHere's a new version of the patch-- I didn't realize the query parameter could be an array. This should be "more correct".
I can confirm the following URL works with this patch, not sure about the previous one though:
http://example.com/node/add/{content-type}/{nid}?gids[]={group-nid}
Comment #3
snorkers commentedI reapplied the v2 patch - it's applied, although during the patch process a 'patch unexpectedly ends in middle of line' error is generated. Patched against current release 6.x-1.3
Although the OG context is passed, the node being referenced is not (ie not being prepopulated).
The new 'add referencing node' link is structured:
../node/add/{content-type}/{nid}?gids[]={og nid}. But because adding OG nodes change any URLs/node/add/{content-type}?gids[]={group-nid}to format ofnode/ognodeadd/?type={content-type}&gids[]={group-nid{, the hook_widget() in the module will not recognize the NID and adopts the fallback behavior. It looks like the easiest way may be to change this module so that a query parameter is passed for the referenced node, rather than building the URL. No idea whether this will work without clean URLs..?I've played around with the v2 patch - with destinations on and off. As soon as gids[] is added to the query (regardless of any other parameters), the node referencing will not work.
Not sure a clean patch will come from this...
Comment #4
snorkers commentedHad a little play and this patch now works for me as it builds an create OG post URL using node/ognodeadd/... structure, and built in a special case check in nodereference_url_widget() function.
Reviewers be gentle - my first patch (yay!).
Comment #5
khad commentedpatch v3 gives a page not found error, but patch v2 seems to work for me - both group and referenced node get prepopulated
Comment #6
quicksketchI also couldn't get #4 to work, but #2 seemed pretty close so I started with that patch. The only problem with it was that drupal_get_destination() will not work with the array structure query string, so I had to convert it back to being a concatenated string. I tested out this patch and it seems to work as desired.
I also made one other large change which was replacing og_get_group_context() with og_determine_context_get_group($node). This approach seemed safer because it took the $node object as a parameter, so it should work properly when showing a list of nodes which may not necessarily be in the same group.
Comment #7
quicksketchComment #8
snorkers commentedI think the v3 version doesn't work unless you've got og_user_roles module too (which changes the URL structure for new nodes). Sorry for confusion. My bad
Comment #10
snorkers commentedog_determine_context_get_group($node) does not seem to work for me - only og_get_group_context() adds the necessary
gids[]=GROUP_IDparameter to the URL. (Line 140 in nodereference_url.module)My apologies for a late reply to this. Took a while to rebuild site on version 4 of OG User Roles (which has a correct URL construct for adding new nodes - see comments #4 and #8), before I could update to latest version of nodereference_url
Comment #11
quicksketchThanks for the report snorkers. I think that it depends on your use-case which function is going to work for you. If you're on a page that doesn't have an OG context (like the Front page), then og_get_group_context() isn't going to work. However if the node that is being referenced isn't in a group, then og_determine_context_get_group($node) won't work.
So a good solution here is to try both. I decided to use og_get_group_context() first, since you'll usually be adding nodes to the group you're currently looking at (if any), then fallback to checking the node that you're referencing as the desired group. Please let me know if this works for you and I'll make a new release. Set back to needs work if this doesn't work.
Comment #12
snorkers commentedThanks Nate
Simple solution and works just fine - sorry for not thinking a little harder before posting... should have thought of that.
Comment #14
snorkers commentedFixed in release 6.x-1.6
Comment #16
jippie1948 commentedHi,
I still seem to have the above problem with a node that is related to one or more groups. If not, everything works as intended.
When I click the Add button, some activity seems to take place but visually nothng happens.
When I hover over the Add button the following URL appears:
mysite/en/node/add/image/477?desitnation is node/477&gids[]=364
Looking forward to haring form you.
JanPieter.
Comment #17
jippie1948 commentedMy apologies: Apparently I had a senior moment when reading late at night this issue. I missed the problem with the OGUR old version.
After had installed version 4.1 the problem disappeared. :-)