joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.2] Notification email on admin registration approval

Open carlitorweb opened this issue 2 years ago • 55 comments

This is a rework for j4 of this PR #20282

Summary of Changes

The user who are manually actived will receive a notification by email informing his account has been activated. There is also the option of being able to manually send a reminder email to the user even though the account is already activated (in case the user do not login in the page after X time) The mail template used is com_users.registration.user.admin_activated

Testing Instructions

Apply the PR and after run npm run build:js -- build/media_source/com_users/js

  1. Open the frontend and create a new user account
  2. Open the User edit view inside the administration, and you will notice a new button in the toolbar
  3. Use the button and check the user was actived and also a email sent to the email of the new user
  • A email will be sent also if the user is actived in the Users list view using the Actions -> Active option

Actual result BEFORE applying this Pull Request

You can active a user, but not notification is sent.

Expected result AFTER applying this Pull Request

You can active a user, but a notification is sent.

Accept suggestions for:

  • Button text
  • Button icon
  • Button color

user

Link to documentations

Please select:

  • [x] Documentation link for docs.joomla.org Page: Users:_Edit_Profile -> Document the new toolbar button Page: Users -> Here just need mention that active the user will send a email with the notification.

  • [x] No documentation changes for manual.joomla.org needed

carlitorweb avatar Jan 16 '23 19:01 carlitorweb

/me dancing with joy

brianteeman avatar Jan 16 '23 19:01 brianteeman

Looking good - two small issues

  1. When using the new button I expected to get a message saying "the email has been sent" or something like that
  2. The email that is sent is just the language keys not the values image

Guessing that you need to copy the language strings from the site language file to the admin language file

brianteeman avatar Jan 17 '23 10:01 brianteeman

or maybe the issue is that its not using the mail template

brianteeman avatar Jan 17 '23 10:01 brianteeman

My bad, I totally forgot the "mail sent" notification.

The other issue is weird, that worked for me in local. I will do a fresh Joomla install and check from there, maybe I had some changes made in the repo I was using...but still weird, somehow the mailer is not loading the strings..

I will check later this

carlitorweb avatar Jan 17 '23 15:01 carlitorweb

@brianteeman Okay you was right, the com_users.ini language loaded was only from the administrator part, as is expected.

So adding the follow:

// Load com_users site language strings
$language = $app->getLanguage();
$language->load('com_users', JPATH_SITE);

Fix the problem. But I really not like this solution. The best approch is just copy the strings to the administrator .ini language file. Is okay do it like this?

carlitorweb avatar Jan 17 '23 16:01 carlitorweb

How do the other com_users admin emails do it? Is it perhaps because you are not using the new mail templates?

brianteeman avatar Jan 17 '23 16:01 brianteeman

Is it perhaps because you are not using the new mail templates?

I using it, yes:

$mailer = new \Joomla\CMS\Mail\MailTemplate('com_users.registration.user.admin_activated', $app->getLanguage()->getTag());
$mailer->addTemplateData($mailData);
$mailer->addRecipient($userMail);

How do the other com_users admin emails do it?

They have all the string in the administrator .ini file

carlitorweb avatar Jan 17 '23 16:01 carlitorweb

They have all the string in the administrator .ini file

I cant see them

brianteeman avatar Jan 17 '23 17:01 brianteeman

from here: https://github.com/joomla/joomla-cms/blob/92c014932228dae7a225184a04b01f0566b336c9/administrator/language/en-GB/com_users.ini#L323

carlitorweb avatar Jan 17 '23 17:01 carlitorweb

Those are not the email strings. These are https://github.com/joomla/joomla-cms/blob/92c014932228dae7a225184a04b01f0566b336c9/language/en-GB/com_users.ini#L11-L25

brianteeman avatar Jan 17 '23 17:01 brianteeman

Right, I though you meant the one used in the actions in the administrator.

The first 2 strings are used in the users registration Model in the site part https://github.com/joomla/joomla-cms/blob/92c014932228dae7a225184a04b01f0566b336c9/components/com_users/src/Model/RegistrationModel.php#L214

The rest are actions triggered by a normal user, also in the site part.

carlitorweb avatar Jan 17 '23 18:01 carlitorweb

When using the new button I expected to get a message saying "the email has been sent" or something like that

Done (new string added)

The email that is sent is just the language keys not the values

Done

carlitorweb avatar Jan 18 '23 02:01 carlitorweb

Last changes all look good. One more thing

image

The button should not be displayed at all when $isNew

brianteeman avatar Jan 18 '23 07:01 brianteeman

Last changes all look good. One more thing

Done. And don't worry, while more corrections the better. Thank you for the help in this.

carlitorweb avatar Jan 18 '23 12:01 carlitorweb

Last changes all look good. One more thing

Done. And don't worry, while more corrections the better. Thank you for the help in this.

Purely self motivated as I need this functionality and currently I just have an ugly hack

brianteeman avatar Jan 18 '23 12:01 brianteeman

I have tested this item :white_check_mark: successfully on 8edcee8a552a37b9fca58bc862e712230c837d5c


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39650.

brianteeman avatar Jan 19 '23 12:01 brianteeman

Maybe hide the Send Activation Reminder button when lastvisitDate is not null. Currently, clicking on it appears to do nothing and no message.

Quy avatar Jan 20 '23 01:01 Quy

@Quy thank you, I was asking the wrong question in that check. Now is okay

carlitorweb avatar Jan 20 '23 03:01 carlitorweb

Please do not merge, the branch is in 'freeze' state until Tuesday. Thank you!

obuisard avatar Feb 04 '23 19:02 obuisard

@obuisard is this ready to merge? or is 4.3 closed again?

HLeithner avatar Feb 18 '23 09:02 HLeithner

@HLeithner It needs 2 human tests again as it has been changed after tests.

richard67 avatar Feb 18 '23 10:02 richard67

As we're in feature freeze, it's for 4.4.

bembelimen avatar Feb 18 '23 10:02 bembelimen

4.4 doesn't get new features?

HLeithner avatar Feb 18 '23 11:02 HLeithner

~Feature freeze your xcept for the priviliged few.~

So that means that the guided tour component that @obuisard and others have been working hard will not be nmerged until 2024

brianteeman avatar Feb 18 '23 11:02 brianteeman

4.4 doesn't get new features?

@HLeithner I guess you wanted to ask about 4.3.

richard67 avatar Feb 18 '23 11:02 richard67

no 4.4 is a bridge release without new features like joomla 3.10

HLeithner avatar Feb 18 '23 11:02 HLeithner

no 4.4 is a bridge release without new features like joomla 3.10

Ah, yes, I forgot, but now I remember.

richard67 avatar Feb 18 '23 11:02 richard67

So according to the extended definition of a feature to include anythingn that is not an error that means that nothing new will happen in Joomla until 2024?

brianteeman avatar Feb 18 '23 12:02 brianteeman

5.0 is planned for mid October 2023

HLeithner avatar Feb 18 '23 12:02 HLeithner

4.4 doesn't get new features?

Yes, you're right, as it's in parallel, i mixed it up. I mean of course 5.0.

~Feature freeze your xcept for the priviliged few.~

Yup, there are some exceptions, where the one or other already benefit from, by getting more time to finish a feature, sometimes till Beta 3.

A few months ago, the planned development was too fast, now it's too slow, one never can make it right....

bembelimen avatar Feb 21 '23 09:02 bembelimen