2

I'm writing a module with custom tokens.

I need a token that generates a hash based on three other tokens: user id, poll id and (poll) option id. The idea is that a user gets links to vote by email and she can vote just by hitting the link, but to authenticate the link I need to generate a unique, checkable hash in it. So I should be able to write a mass mail with tokens that would contain links like

<a href="http:/mysite/votingpage/[user:uid]/[poll:nid]/[poll:option:id]/[hash(user, poll, option)]>Option text</a>

(I know the tokens are not right, but you get what I mean).

Then I would check if the hash is true for the user, poll and option, and save the vote if true.

The problem is I can't get the token for hash to be computed from the other tokens, I don't know how to go about it. Maybe I don't understand how the 'need-data' field in the hook_token_info function works, or maybe it isn't possible out of the box.

Any ideas?

Your Answer

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

Browse other questions tagged or ask your own question.