Is there some guide for using this?

Created on 1 July 2023, 12 months ago

Problem/Motivation

I really want to use this module, but I struggle with finding information on how.

I get this part:

launch an email confirmation in just 1 line
\Drupal::service('email_confirmer')->confirm('somemail@example.com');
get notified of successful confirmation via “hook”
your module will be notified when the user confirms (or cancels)

But, then what?

I see the hook, but I don't see how I relate it's confirmation message with the user who just confirmed.


/**
 * @file
 * Document api for email confirmer module.
 */

use Drupal\email_confirmer\EmailConfirmationInterface;

/**
 * Acts on email confirmation responses.
 *
 * This hook allows a module to get notified when a confirmation response
 * is received.
 *
 * @param string $op
 *   Either "confirm" or "cancel".
 * @param \Drupal\email_confirmer\EmailConfirmationInterface $confirmation
 *   The confirmation process.
 */
function hook_email_confirmer($op, EmailConfirmationInterface $confirmation) {
  // Log the event.
  \Drupal::logger('email_confirmer')->info('Email confirmation @cid ' . ($op == 'confirm' ? 'confirmed' : 'cancelled'), ['@cid' => $confirmation->id() ?: '-not saved-']);
}

If every user is confirmed in a database, what methods exist to access that information and take advantage of these features?

General features
confirmations can be cancelled
if someone enters another person's email, the recipient can explicitly reject the confirmation
automatic purge of old records
processed or expired confirmations are automatically purged (can be disabled by configuration)
spool for recurring requests
the first email for requesting confirmation is delivered immediately, the following are queued
optional restricted validation by IP address
the confirmation link must be opened from the same connection that initiates the confirmation process
multiple configurable parameters
confirmation timeout and lifetime, response messages, confirmation request email..

I mean, yes, I could write my own queries, but I assume these methods already exist. I could just use some guide to point me in the right direction.

Thanks!

💬 Support request
Status

Active

Component

Documentation

Created by

🇺🇸United States SomebodySysop

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024