custom redirection after multiple node creation
rkahlert - July 22, 2009 - 16:30
| Project: | Image FUpload |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
Hi,
I would like to redirect my users back to the original page they are coming from afte the finished the upload progress instead showing the upload form again. How is this possible?

#1
Sorry for the double post, but it would be great to just redirect to one of the newly created nodes as well.
#2
If you use Multiple upload mode and the redirect url field keeps empty, fupload will redirect to the newly created node. This will only work for the imagefield integration.
#3
ok I'm using imagefield but the single image per node mode. But thanks so far, maybe I can hack errr... extend that to redirect to any of the new nodes even in single mode. :)
#4
This isn't a good solution. We need some more work on this.
#5
what do you mean by that? I just needed to change one line to achieve this behaviour. I can provide a patch with an option to turn this feature on.
#6
So here is the patch against the dev-version. Very few changes, it would be nice if you include it.
#7
I am trying to understand this issue. I want to use FUpload all over my site where I have complex node types with photos part of the node creation using a CCK imagefield. So when I add FUpload for the images, which I want to be saved as individual nodes, everything works great except that rather than being taken to the saved node that the images are 'attached' to that I just created, I am taken back to the node create page to create a new node? Why? What is the logic here? Why not back to the saved node for which the images are attached?
I see there is an url redirect, but what am I supposed to put in here? What is the format to add for the url to redirect to the created node?
Also why when I return to edit the node, which I have to access through "recent poosts", does FUPload no longer appear? I know it says it can be used only once? But why. This will be a usability issue for me and also not allow me to use FUpload for galleries or pages where different users add images. This would mean it is only good for the node creation... a usability issue that will be hard to explain to my editors.
As for the patch above, I tried creating that, but have several issues. First off it doesn't tell you to which file the patch is to be applied to. I figured it out to be image_fupload_imagefield_widget.inc. Then I got the message: "Hunk #1 FAILED at 211.
1 out of 1 hunk FAILED -- saving rejects to file image_fupload_imagefield_widget.inc.rej" On using the patched module, first I got the messages that the required fields needed content which they did and the images where not saved, and then it gave me a node creation page without the required fields, uploaded the images, but then saved the same number of nodes as images I was uploading, but with only one image per node... ?
#8
Fupload one image per node is an excellent solution to combine with the lullabot.com video on photo-galleries with views-attach.... however, the images are added from the gallery page, not the photopage, so the after upload Fupload needs to take you back to the gallery view. What would be the url or code for this? I also use Fupload from other content types as aCCK filed, where I want my users taken back to the node they came from, not to the Fupload page.
#9
tjbcham, this is exactly what I also need: a way to return to my gallery page, not the individual photos
#10
Any comments?
#11
Did you try to add the ?destination=node/gallery_id at the end of the link to the image creation form?
#12
the problem is that link is created with node reference cck widget set the [Reference from url] there is also a Return path setting there but when using the image_fupload module it doesnt seem to work, or its being superseded by the Redirect url stuff from it.
What can we place into the {Redirect url:} setting that will bring them back to the node being referenced and not the node/add image content type.
Im not sure where yet but somethings keeping it from doing what we want. Is there no way to use the {Redirect url:} bit?
My guess is we need that ?destination=node/gallery_id parameter added to the [Done Editing] button. But I dont see how to do that without hacking.
#13
rkahlert .. I did apply your patch but the its loosing the bits once you get to the [done editing] button and then redirecting to the node/add
#14
omg! nevermind ... use rules module .. ive already done this.. guess thats my brain fart for the day.
#15
I solved this issue by editing 2 files
1) image_fupload_image.module line 44
$redirect_url = url('node/add/image/list_images/'.arg(3));
2) images.previewlist.image.inc line 68
$form['#redirect'] = 'node/' .arg(4); // redirect to first upload page again
#16
Ok, but this is a hack. Please note that an update will be difficult like this. But it's a solution at the moment.
#17
Subscribing to this, my use case is also the Lullabot image gallery as mentioned in #8 (http://www.lullabot.com/articles/photo-galleries-views-attach) . Having it redirect to the node reference URL would be fantastic.
#18
For cases like this image fupload should support tokens.
#19
Hi Guys
See my solution here (sorry I only saw this issue now). Not 100% complete but I think it is a good starting point. Works perfectly for single-image-per-node pages, but needs a line or 2 of code for multiple-images-per-node
#535924: Module breaks destination param
Hope this helps!
#20
Subscribing. Just found this thread and #535924 today have anyone tested the patch in #535924 or found another clever way to solve this?
#21
I gave up and used the http://drupal.org/project/rules module. After a little forth and back I was able to get it to redirect correctly to node_ref. If you never have used Rules, here is my export. Just import it, after that you prob have to tweak the settings a bit to make it work on your content type. Remember to activate redirect for the “Fupload list images imagefield” form.
array ('rules' =>
array (
'rules_2' =>
array (
'#type' => 'rule',
'#set' => 'event_node_presave',
'#label' => 'Redirect To A Node Reference After Node Creation',
'#active' => 1,
'#weight' => '0',
'#status' => 'custom',
'#conditions' =>
array (
0 =>
array (
'#type' => 'condition',
'#settings' =>
array (
'type' =>
array (
'bilde' => 'bilde',
),
'#argument map' =>
array (
'node' => 'node',
),
),
'#name' => 'rules_condition_content_is_type',
'#info' =>
array (
'label' => 'content is Bilde',
'label callback' => false,
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content',
),
),
'module' => 'Node',
),
'#weight' => 0,
),
),
'#actions' =>
array (
0 =>
array (
'#info' =>
array (
'label' => 'Load a referenced node',
'arguments' =>
array (
'node' =>
array (
'type' => 'node',
'label' => 'Content containing the node reference field',
),
),
'new variables' =>
array (
'referenced_node_to' =>
array (
'label' => 'referenced nodings',
'label callback' => false,
'type' => 'node',
),
),
'module' => 'CCK',
),
'#name' => 'nodereference_rules_action_load',
'#settings' =>
array (
'field' => 'field_album',
'#argument map' =>
array (
'node' => 'node_unchanged',
'referenced_node' => 'referenced_node_to',
),
),
'#type' => 'action',
'#weight' => 1,
),
1 =>
array (
'#weight' => 1,
'#info' =>
array (
'label' => 'Page redirect',
'module' => 'System',
'eval input' =>
array (
0 => 'path',
1 => 'query',
2 => 'fragment',
),
),
'#name' => 'rules_action_drupal_goto',
'#settings' =>
array (
'path' => 'node/[referenced_node_to:nid]',
'query' => '',
'fragment' => '',
'force' => 0,
'immediate' => 0,
'override' => 1,
'#eval input' =>
array (
'token_rules_input_evaluator' =>
array (
'path' =>
array (
0 => 'referenced_node_to',
),
),
),
),
'#type' => 'action',
),
),
'#version' => 6003,
'#categories' =>
array (
),
),
),
)