Looking at the og_node_create_links function and particularly the discussion / changes that were implemented with this Issue: #1848028: The $destination paramater for the og_node_create_links function is not used this function still seems to behave incorrectly in that it is always setting a destination value on the link regardless if one is passed. Is there a reason for this that I may be missing? I understand the need in some implementations to have a user create a piece of content and be redirected to the groups home page, but why is this the default behavior?
Ideally, the function would not set a destination unless one was passed, and if the dev wanted the create links in a way that redirected the end user back to the group home page, then they could pass the url in as destination. But as it stands, you can't unset the destination in this function.
This came up when we tried to use the function and have the user redirected to the content they just created (default node create behavior).
Basically, just drop the else block in the code below. (And then fix og_extras if that module wants the default behavior to be "Go back to home page") I'm happy to submit a patch to change this, but I just wanted to make sure there wasn't a reason for it.
Around line 3307 of og.module
$options = array(
'query' => array($field_name => $gid),
);
if ($destination) {
$options['query']['destination'] = $destination;
}
else {
$options['query'] += drupal_get_destination();
}
Thanks,
Stan
Comment | File | Size | Author |
---|---|---|---|
#6 | og-1983450-6.patch | 817 bytes | star-szr |
#6 | interdiff.txt | 416 bytes | star-szr |
#1 | og-1983450-1.patch | 818 bytes | star-szr |
Comments
Comment #1
star-szrI ran into this same problem myself.
Here is a proposed solution that would maintain API backwards compatibility. Pass FALSE as the destination parameter to not append a destination to the node create links.
Comment #3
star-szrCorrecting version number.
Comment #4
star-szr#1: og-1983450-1.patch queued for re-testing.
Comment #5
itamar CreditAttribution: itamar commentedMinor: else if => elseif
Comment #6
star-szrThanks @itamar, old habits…
Comment #7
amitaibuCommitted, thanks.