1

I have a created a custom module with simple form with only three fields (URL, title, and email), where user must enter all the fields for submission.

screenshot

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 email).

How do I generate a token and store it in the database to use it for validation?

1 Answer 1

0

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.

1
  • 1
    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.
    – Elin Y.
    Commented Oct 22, 2013 at 6:29

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