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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rkahlert’s picture

Sorry for the double post, but it would be great to just redirect to one of the newly created nodes as well.

grandcat’s picture

Status: Active » Fixed

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.

rkahlert’s picture

Status: Fixed » Active

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. :)

grandcat’s picture

redirect to any of the new nodes even in single mode

This isn't a good solution. We need some more work on this.

rkahlert’s picture

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.

rkahlert’s picture

Version: 6.x-3.0-rc2 » 6.x-3.x-dev
Component: Miscellaneous » Code
Category: support » feature
Status: Active » Needs review
FileSize
2.71 KB

So here is the patch against the dev-version. Very few changes, it would be nice if you include it.

tjb74’s picture

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... ?

tjb74’s picture

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.

kirilius’s picture

tjbcham, this is exactly what I also need: a way to return to my gallery page, not the individual photos

kirilius’s picture

Any comments?

rkahlert’s picture

Did you try to add the ?destination=node/gallery_id at the end of the link to the image creation form?

Macronomicus’s picture

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.

Macronomicus’s picture

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

Macronomicus’s picture

omg! nevermind ... use rules module .. ive already done this.. guess thats my brain fart for the day.

finlaycm’s picture

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

grandcat’s picture

Ok, but this is a hack. Please note that an update will be difficult like this. But it's a solution at the moment.

droolpal’s picture

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.

osopolar’s picture

For cases like this image fupload should support tokens.

nightowl77’s picture

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!

steinmb’s picture

Subscribing. Just found this thread and #535924 today have anyone tested the patch in #535924 or found another clever way to solve this?

steinmb’s picture

Status: Needs review » Fixed

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 (
      ),
    ),
  ),
)
steinmb’s picture

Status: Fixed » Closed (fixed)
kirilius’s picture

Title: custom redirection after multiple node creation using tokens » custom redirection after multiple node creation
Status: Active » Closed (fixed)

Can you please clarify: is this marked as "fixed" because the feature is implemented in the latest release or because the #21 above found a workaround?

frankcarey’s picture

Title: custom redirection after multiple node creation » custom redirection after multiple node creation using tokens
Status: Closed (fixed) » Active

I don't think this was actually fixed, i think steinmb provided a solution, but perhaps token integration is the better route for novice users? Here are instructions on how to implement token hooks. http://drupal.org/node/307140

frankcarey’s picture

FYI: I'm working on this now

kirilius’s picture

Will you please elaborate? I would like to use Rules to redirect to the original page but I haven't used the module before. What trigger/event should be used in this case?

frankcarey’s picture

rules has nothing to do with token module support, you should enable the rules form actions module along witht he rules module, and then import the rule in #21. explainig rules is a quite a handful, but i'll just say that they way this is going to work is that the rule above will be triggered after submitting the image preview page, and it will override the redirect to the place of your choosing.

If you you want to use a tokens instead, stay tuned...

kirilius’s picture

Tokens is definitely the way to go, I guess I'll wait. Thanks!

frankcarey’s picture

FileSize
3.14 KB

OK, this adds token module support to the redirect field in the settings. It loads the last node uploaded, and uses tokens based off of that node. I'm using it to redirect users to the gallery (nodereference). Be careful if you are using it for a token that may or may not exist (a non-required field for instance).

kirilius’s picture

Thanks!

Can that be added to a release instead of a separate patch? I cannot use patches as I am working on Windows and I am sure I am not alone.

kirilius’s picture

Title: custom redirection after multiple node creation » custom redirection after multiple node creation using tokens
Status: Closed (fixed) » Active

Does anybody know whether the patch above is included in the latest dev release (6.x-3.x-dev) from 2010-Feb-02?

Thanks!

grandcat’s picture

No, currently it isn't.

kirilius’s picture

Thanks, is there any plan to include it any time soon then?

grandcat’s picture

I think yes, but I want to work a bit more on the user interface.

frankcarey’s picture

grandcat: the interface in what way?

frankcarey’s picture

Status: Active » Needs review

Note this is working on my site, but I'd like to get one more person to confirm. Patch working on feb 3.x dev

jcmarco’s picture

Status: Needs review » Reviewed & tested by the community

Tested. It works fine. Thank you.

kirilius’s picture

Is that still a patch or a part of a release?

Thanks!

Romejoe’s picture

Would like it in the release as well!

grandcat’s picture

Will be submitted soon. Great thanks to frankcarey again !

grandcat’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
BetaTheta’s picture

Is the patch already been ported? It seems like it hasn't, but just making sure

grandcat’s picture

It isn't right now. My CVS isn't working at the moment.

anantagati’s picture

Patch works good on latest dev, thanks.

Dokuro’s picture

Patch does not seem to work if you are using this with one image one node settings. Anyone get this working doing so?

brunorios1’s picture

subscribing...

brunorios1’s picture

the patch works!

but the token isn't replaced if the user don't have the "edit captions" permission, and after the uploads the page is redirected to a url with a not replaced [token] and shows a 404 error...

thanks!