Pageroute module destination parameter how/where?

Events happening in the community are now at Drupal community events on www.drupal.org.
zzJames's picture

Hi

I realise this is a support question, but it raised no joy for me in the usual drupal forum, so I ask here because maybe there are more experienced people using Wolfgang's modules (or Wolfgang himself!)

ok question is.....

in the pagerouteUI admin pages there is an option "Preserve destination parameter during this route."

I assume this means the URL to be directed to at the end of the route?

How do I pass/specify this parameter, there seems to be nothing in the pageroute documentation.....

Thankyou

zz_james

Comments

last node

zzJames's picture

since the I wanted the destination to be a view of the usernode, I just made it the last step in the route, and took the 'back' button away.

didn't work

zzJames's picture

any ideas pageroute guru's..

destination parameter

terrybritton's picture

The destination parameter needs to be used in the url for the pageroute. So if you installed per the handbook, your url would be nodeprofile?destination=userprofile. Or whatever you want in place of userprofile. Again, if you installed per the handbook you will have a link in navigation called nodeprofile. Unfortunately the path in this menu item is locked and you can't change it, so you will have to create a new menu item with the fully qualified url: http://www.google.com/nodeprofile?destination=userprofile.

For some reason I couldn't get it to work without the fully qualified path.

absolute URL

firebus's picture

because without the full URL including protocol drupal urlencodes the string. ugh. why does it have to be so painful?!

i also tried writerprofile/destination/userprofile hoping that clean urls might take care of it, but no such luck :)

hopefully i'll remember to change this path when i got from my dev site to my live site...

i definitely agree that it would be nice if pageroute had a generic "view any page" page type

destination

fago's picture

of course, this is also a possible solution.

otherwise the parameter would be destination, e.g. use pageroute_path?destination=usernode.
with the option you mentioned checked, the user will be routed to the path /usernode on "exit"

things don't quite fit???

liquidcms's picture

as always seems to be the drupal case.. lots of cool things.. but they just don't quite fit together

so i am trying both zz's and fago's ideas here.. and here are the issues with both:

i am trying to put together a registration flow

  • i think there is a big issue with pageroute in that it can only route to a node type - i.e. it can't route to a page like user/register or a view or...

so my best attempt so far uses:

  • rolesignup - i have multiple roles to auto register for
  • logintoboggon - since it has some things i need, plus it allows me to set redirect page
  • registerprofile, usernodes, etc, etc...

so basically i have:

  • basic login from logintoboggon
  • 1 added nodeprofile since i have required fields (using registerprofile)
  • logintoboggon redirects to my pageroute when done
  • now i can fill out my 2nd usernode type

AND then when i am done i want to do what zz wants.. and go to some view

BUT.. the issues:

fago's:

  • my register paths look like: user/register/role/5
  • so i dont think it works to add a destination to that such as user/register/role/5?destination=usernode

zzJames:

  • major basic issue - you can't route to non-nodes - i.e. you can't route to a view.. as far as i can tell

also i need 2 different page routes to go to depending on which role i am signing up for.. and logintoboggon will be broken here since it has only one redirect setting

so i either have to hack logintoboggon to handle this or hack pageroute

Peter Lindstrom
LiquidCMS

step closer

liquidcms's picture

ok, i guess the almost answer above was that the logintobogon would set the redirect to:

mypageroute?destination=usernode

and that does work

but as mentioned i have the issue of having multiple redirects.. which i guess is a hack, hook or feature addition to logintoboggon module.. let you know what i come up with

Peter Lindstrom
LiquidCMS

A couple hacks

sf_developer's picture

As I too have butted up against this limitation I've found a couple different approaches to this.

1) If the last page in your pageroute is one on which you are editing or creating a node, you can make the template for that node contain a button or anchor tag that contains the link to your intended destination. In my case, the last node in my registration pageroute is a page where the user is filling out a custom questionaire content type, and not something they'll ever edit again. So the template for this node view can contain whatever I want and I don't have to worry about anyone ever seeing this again. You may be able to create a custom type with no fields, assign it to the last page in your pageroute, and just have the template for this node contain a button that links to where you want. I haven't tried using an empty content type for this purpose however, I've only used an empty content type as a nodefamily head.

2) Another approach is to modify the pageroute code. The rubber meets the road in the function "pageroute_page_form_submit_redirect" round about line 213 at the time of this writing, in the "case PAGEROUTE_FORWARD" code. I found in DBG that when the code reached here, the $_REQUEST didn't have a destination anymore, so my pageroute was circling back to the start of itself. However, if you properly rearrange the encompassed condition, and do some poking around in the $page you can determine what pageroute you're on, and determine if you want to commandeer the $_REQUEST's destination. I did this successfully as a quick hack for a demo. But it's really a hack. Here's how it might look.

  case PAGEROUTE_FORWARD:
    if ($page->route->options['last_button'] && !$page->options['neighbours']['forward'] ) {
        if( isset($_REQUEST['destination']) ) {
            return ''; //let drupal_goto take care of the destination paramter
        }
        /*
         * Since the request does not have a destination, I'm putting in
         * this hack to check if we're on a registration pageroute.  If we
         * are, I'm going to assign "home" as the destination and let
         * Drupal just take care of forwarding.  "home" is the 
         * url to a view in my Drupal setup.
         */
        if( $page->route->path == 'registrationroute'  ) {
            $REQUEST[ 'destination' ] = "home";
            return ''; //let drupal_goto take care of the destination paramter
        }
    }
    $path = pageroute_create_path($page, $page->options['neighbours']['forward']);
    break;

Profiles as nodes

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week