Closed (fixed)
Project:
Simplenews
Version:
4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 May 2024 at 17:30 UTC
Updated:
16 Oct 2024 at 16:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
vlad.dancerComment #5
vlad.dancerResults for the test case:
Comment #6
vlad.dancerComment #7
vlad.dancerFor the moment developers can set language in the next way:
Or even add language dropdown:
UPD: for 4.x version the form hook is a bit different.
Comment #8
vlad.dancerComment #10
aditiup commentedHello sir,
For the issue #3447905 I recommend the following alterations to be made
Wrong subscriber's prefered language for anonymous user when interface language is not default
Changes to be made:
1) Changes in SubscriptionsBlockForm.php
form Method Modification:
Inside the form method, check if the current user is anonymous using \Drupal::currentUser()->isAnonymous().
If the user is anonymous, set the default value of the langcode field to the current interface language using \Drupal::languageManager()->getCurrentLanguage()->getId().
2) Changes in simplenews.module
-simplenews_form_alter Hook Implementation:
This function alters forms based on their ID. It checks the form ID and calls specific functions to modify the forms.
Newly Added: simplenews_form_alter function is added to handle different form alterations in a centralized manner.
-simplenews_form_user_register_form_alter:
Adds subscription options to the user registration form.
Previously Provided: This function was given earlier and is now included in the simplenews.module.
-simplenews_user_profile_form_submit:
Handles the submission of the user registration form, processing newsletter subscriptions.
Previously Provided: This function was given earlier and is now included in the simplenews.module.
-simplenews_form_simplenews_subscriptions_block_alter:
Ensures anonymous subscribers get the correct language based on the current user interface language.
Newly Added: This function was added to fix the issue with the wrong preferred language for anonymous users.
Comment #11
aditiup commentedComment #12
vlad.dancer@Aditiup 16.92MB patch with over 234053 lines changed, is it purposely?
Regarding last commit in MR54 with +117/-168 changes in simplenews.module. These changes will never be reviewed/accepted at once.
Comment #13
azizos commented@vlad.dancer As her mentor for GSoC (Google Summer of Code) 2024, I would like to dedicate time this weekend to review and test her work. If you have any other suggestions or ideas, I would be happy to hear them.
Comment #14
azizos commentedI was busy last weekend by work and family plans. I will dedicate this weekend for testing @Aditiup work.
Comment #15
adamps commentedUnfortunately I can't understand the last commit added in #9. It makes many changes that don't seem related to this issue.
I suggest we go back to the previous commit which basically looks good but there were some test failures.
Comment #17
davps commentedMR's branch reset to last stable commits and rebased on to 4.x. Ready to review.
Comment #19
adamps commentedGreat thanks