When using hook_url_outbound_alter() to rewrite links to include the tokenauth token, tokenauth_get_token() is called. This function just hits the database. Stash the value as a static and the extra database hits can be avoided.

Comments

hefox’s picture

StatusFileSize
new1.12 KB

Adding a reset and resetting it after updating the token.

Tested via:


dsm('Should say original token: ' . tokenauth_get_token(1));

tokenauth_reset_user(1, 'blah');
dsm('Should say blah: ' . tokenauth_get_token(1));

$result = array(
  'token' => 'blah2',
  'uid' => 1,
);
drupal_write_record('tokenauth_tokens', $result, 'uid');

dsm('Should say old token: ' . tokenauth_get_token(1));
dsm('Should say blah2: ' . tokenauth_get_token(1, TRUE));

Grayside’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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