'show_mail_in_messages' is not a supported key.

Created on 7 March 2024, 10 months ago
Updated 17 June 2024, 6 months ago

Problem/Motivation

I get this on /admin/config/people when I save the page

'show_mail_in_messages' is not a supported key.

it is here:

html/profiles/contrib/social/modules/social_features/social_user/src/Form/SocialUserPasswordForm.ph:94:    $show_mail = $site_config->get('show_mail_in_messages');
html/profiles/contrib/social/modules/social_features/social_user/social_user.module:575:  $form['site_information']['show_mail_in_messages'] = [
html/profiles/contrib/social/modules/social_features/social_user/social_user.module:579:    "#default_value" => $config->get('show_mail_in_messages'),
html/profiles/contrib/social/modules/social_features/social_user/social_user.module:592:  $config->set('show_mail_in_messages', $form_state->getValue("show_mail_in_messages"));

where is it set?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

12.2

Component

Code (back-end)

Created by

🇺🇸United States SocialNicheGuru

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

Comments & Activities

  • Issue created by @SocialNicheGuru
  • 🇨🇦Canada leducdubleuet Chicoutimi QC

    Same problem here, the configuration page /admin/config/people/accounts cannot be saved on a new opensocial site.

    I wonder if this issue should be set to major since we cannot close the site registration by default as it is?

  • 🇺🇸United States SocialNicheGuru

    as a workaround could we define it in settings.local.php

    For example something like
    $settings['show_mail_in_messages'] = 0;

  • 🇮🇳India prathamesh.save

    For workaround you can delete the 'show_mail_in_messages' config value using below methods:
    1: drush config:get system.site // Check if this returns the show_mail_in_messages as key if yes execute below command
    2: drush config:delete system.site show_mail_in_messages // this will remove the entry from config

    For code, I guess need social_user module needs to update, where it is storing the values in 'system.site' this needs to be updated either to module level or "social_swiftmail.settings" in this config so that Drupal will not throw the unsupported key error(As per my research if any contrib module adds any config entry in System config Drupal throws this error).

    Something like social_features/social_user/social_user.module:

    function social_user_form_system_site_information_settings_submit($form, FormStateInterface $form_state) {
      $config = \Drupal::configFactory()
        ->getEditable('social_swiftmail.settings');
      $config->set('show_mail_in_messages', $form_state->getValue("show_mail_in_messages"));
      $config->save();
    }

    Above code is partial it may help developer to understand.

  • 🇬🇧United Kingdom kevster

    Im getting this too when I try and save admin/config/people/accounts.

    drupal 10.2.5
    PHP 8.2.18
    open social 12.3.3

  • 🇧🇷Brazil viniciusrp

    This error happen because we are saving this variable at system.site config and this variable is not declared at schema yaml file.

    I fixed it and needs be reviwed.
    PR: https://github.com/goalgorilla/open_social/pull/3869

  • Assigned to viniciusrp
  • Status changed to Needs review 8 months ago
  • 🇬🇧United Kingdom kevster

    Many thanks @viniciusrp - Ive applied the patches manually - all good but social_user.install is very different as Im on 12.3.3. I added your lines anyway (sorry Im not a good progammer!)

    I still get the error message "Error message 'show_mail_in_messages' is not a supported key." but I am able to save the page now!

  • 🇺🇸United States SocialNicheGuru

    @kevster I think you do have to take the steps outlined in #4

  • Status changed to Fixed 7 months ago
  • 🇳🇱Netherlands ronaldtebrake

    In 12.4.2 / 12.3.5 and alpha 2 releasing today.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • If you are still experiencing this issue, make sure you remove `show_mail_in_messages: 0` from your system.site.yml, otherwise it will be re-imported and break the form again.

Production build 0.71.5 2024