I was wondering if there's a way to set the _REQUEST['destintion'] variable to include a query string?

Here's my situation in a nutshell:

I've got a form that logged in users can use to submit links to the site. This interaction is initiated via a bookmarklet (essentially a "Digg this" type thing). If they're not logged in, they get sent to the login page. I'm using the login_destination module to send them back to the proper form upon login. But when I try to pass the query string, I'm getting errors.

here's how my function is looking: (assume destination at this point is 'node/add/storylink')

  if ($_REQUEST['destination']) {
    $path = $_REQUEST['destination'];
    $query = '';
    // do a test to see if we're also passing url submission info
    if ($_REQUEST['edit']['url']) {
      $query .= '?edit[url]=' . $_REQUEST['edit']['url'];
    }
    return url($_GET['q'], "destination=$path". urlencode($query));
  }

problem is, that will return a destination string of:

node/add/storylink%3Fedit%5Burl%5D%3Dhttp%3A//www.google.com

if I don't urlencode the querystring, I get redirected to whatever site is in edit[url].

Has anyone else had a problem like this? is there some kind of destination_query_string function that exists?

Thanks!

Comments

cmb’s picture

Has anyone solved this issue?