I have a created a custom module with simple form with only three fields ( Url, title & email ) , where user has to enter all the fields for submission.

enter image description here

I am able to send the mail to the user from my custom module but i need to create and attach a validation link (possibly with unique token for unique email) how do i generate a token so i can store it in database and use it for validating the user later.

(you may also help me with your own approach)


1.Declare custom tokens using hook_token_info()

2.Create custom tokens using hook_tokens()

3.You can use your custom tokens using token_replace() that is call the token_replace at the place where u need to send the email.

4.Create a seperate file inside your module with .tokens.inc extension and include the hook_tokens_info() and hook_tokens() inside it.

  • What the OP asks is not the tokens in that meaning. The information you provided is for the placeholder tokens. The user want to generate some tokens for validation purposes, like one time login links sent on the user registration. – Елин Й. Oct 22 '13 at 6:29

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.