0

I'm trying to generate a custom token to a prepopulated URL. My code looks like this:

        $replacements[$original] = url('user/login', array(
          'query' => array('edit[name]', $account->mail),
          'absolute' => TRUE,
        );

The resulting URL looks like this:

http://example.com/en/user/login&edit[name]=myemail@example.com

But the & should be a ? because it's the start of a query string. What am I doing wrong?

3

This should work for you:

    $replacements[$original] = url('user/login', array(
      'query' => array('edit' => array('name' => $account->mail)),
      'absolute' => TRUE,
    ));

Sidenote: you are naming the argument as name but you are passing the mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.