Using a custom token for node/number, inserting it in a vieuws send mail, I got following error after sending the mail:

Notice: Undefined index: nl in auto_login_url_tokens_tokens() (line216 of sites/all/modules/auto_login_url_tokens/auto_login_url_tokens.module).

The nl is the language code of the default language of my site (Dutch).

The token generated links do log me in, but don't redirect me to the requested page. Instead I'm logged in to the front page.

How can I fix this? All help is much appreciated!

Kind regards

Gregory

Comments

matrixlord’s picture

Hello,

I believe I know what is the problem. Until I fix it, would you mind to test something for me?

Change line 216 from

$url = str_replace('%uid', $user->uid, $token_url->field_alu_token_url[$token_url->language][0]['value']);

to

$url = str_replace('%uid', $user->uid, $token_url->field_alu_token_url[LANGUAGE_NONE][0]['value']);
gregdm7’s picture

Hello Matrixlord

Thanks for your reply, your suggestion did the trick!
Changing that line, I was automatically logged in and redirected to the appropriate page :-)

NB: I think your auto login url module has the same bug as your auto login url tokens module.

Many thanks!

One more question though:
Using the token in an a tag like so:
<a href=" [user:auto-login-url-tokens-47] " target="_blank">link</a>
gives a conflict with the recognition of the tokens. The generated link does log me in, but doesn't contain the right page. The site tries to go to the unconverted token: /auto-login-url-tokens-47%5D

A while ago I did mess around somewhat in the code. I discovered that deleting a part of the code of auto login url resulted in solving the problem. But I forgot how I did it and can't find it anymore. I recall I removed some functions involving the base_url nearby line 242 of auto_login_url.module. And then I used:
<a href="http://www.example.com/[user:auto-login-url-tokens-47] " target="_blank">link</a>
for the link. Such a solution did work, but it isn't clean, is it?

Maybe you have a better suggestion?

Kind regards

Gregory

gregdm7’s picture

Ow! Found it!

My solution involved removing (nearby line 240 in auto_login_url.module)

  // Check if link is absolute.
  $absolute_path = '';
  if ($absolute) {
    global $base_url;
    $absolute_path = $base_url . '/';
  }

and deleting

return $absolute_path . 'autologinurl/' . $hash;

So I could use the token in a link like:
<a href="http://www.example.com/[user:auto-login-url-tokens-47]" target="_blank">link</a>

Hope this helps!

Kind regards

Gregory

matrixlord’s picture

Hello gregdm7,

Thanks for the feedback. I updated the module with code from #1.

As for #3, this shouldn't be the case. That is strange...Can you tell what filter modules do you use for mail and the text format? E.g. pathologic.

gregdm7’s picture

Hey Matrixlord

You're very welcome, thanks for the effort!

I am using a custom filter for the mails send from views send:

  • Limit html tags: <a> <em> <strong> <ul> <ol> <li> <dl> <dt> <dd> <b> <br> <p> <i>
  • Insert line breaks (<br> <p>)

A while ago I did use pathologic, but now it is uninstalled from the database and removed from the modules list.
CKEeditor though is still enabled on my "mail" text-format. I didn't try to disable it yet.

I use mail system and mime mail in order to send html mails.

matrixlord’s picture

Status: Needs work » Fixed

I am closing the issue, since we use Entity Metadata Wrappers now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.