Use default value callback to set default value for mail frequency

Created on 22 October 2024, 24 days ago

Problem/Motivation

Currently, a hook_form_alter is used to set a default value for the "Logs report frequency" field. This means the configured default value is only applied when a user account is created using a form. When created in code or via Drush, the value entity_activity_mail_frequency is null.

Steps to reproduce

Assuming a standard Drupal installation, having both the Entity Activity and Entity Activity Mail modules installed (of course); and having Drush available:

  1. Navigate to /admin/config/content/entity-activity/mail-settings.
  2. Select a value for "Default frequency" that is not "none", e.g., "immediately.
  3. Create a new user account by invoking drush user:create newuser --mail='person@example.com' --password='letmein'.
  4. Edit the user profile of the account created in the previous step.
  5. Notice that the "Logs report frequency" value is not as selected on the module's configuration form.

Proposed resolution

Move the logic implemented in entity_activity_mail_form_user_form_alter() to a default value callback function.

Remaining tasks

  • Implement a solution and create a merge request.
  • Review merge request.

User interface changes

N.a.

API changes

N.a.

Data model changes

N.a.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands watergate

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024