[PLTFRM-475] Add module notify-privileged-activity#19
[PLTFRM-475] Add module notify-privileged-activity#19kat3samsin merged 11 commits intoproductionfrom
notify-privileged-activity#19Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new module, notify-privileged-activity, that sends an email notification to the administration email when a new administrator user is created. Key changes include:
- Loading a new email component and initializing the notify-privileged-activity module.
- Adding MJML-based email templates and a build script to compile them.
- Enabling the Mailpit service in the development environment for testing email delivery.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vip-security-boost.php | Loads the new email/email.php dependency. |
| utils/dev-env.php | Temporarily comments out WP_CLI check to facilitate testing. |
| scripts/build-mjml.sh | Adds a script to compile MJML templates using Node.js and PHP. |
| modules/notify-privileged-activity/class-notify-privileged-activity.php | Implements the email notification on administrator creation. |
| email/templates/.html, email/mjml/.mjml, email/mjml/common/* | Add and update email template files and MJML partials. |
| email/mjml/build-mjml.php | New script to generate HTML emails from MJML templates. |
| email/email.php | Introduces the email sending functionality with template parsing. |
| composer.json | Updates autoload-dev configuration and adds build-mjml script. |
| .wpvip/vip-dev-env.yml.ejs | Enables Mailpit for local email testing. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new module to send privileged activity notifications (an email when an administrator is created) and supports MJML email template compilation. Key changes include:
- Adding the notify-privileged-activity module and its associated class.
- Introducing email handling in email/email.php and related MJML templates.
- Updating the development environment configuration and build scripts.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| vip-security-boost.php | Added email module inclusion to integrate the new notification functionality |
| utils/dev-env.php | Comments adjusted to allow user creation testing without WP_CLI restrictions |
| scripts/build-mjml.sh | New build script for compiling MJML templates using Node.js and PHP |
| modules/notify-privileged-activity/class-notify-privileged-activity.php | New module to send notification emails on new admin user creation |
| email/templates & email/mjml/* | Added email templates and MJML files to support the new notification email design |
| email/email.php | Introduced Email class for sending emails and parsing MJML-based templates |
| composer.json | Updated autoload-dev and added a new build-mjml script |
| .wpvip/vip-dev-env.yml.ejs | Enabled Mailpit for testing emails |
| $admin_email = get_option( 'admin_email' ); | ||
|
|
||
| if ( empty( $admin_email ) || ! is_email( $admin_email ) ) { | ||
| return; |
There was a problem hiding this comment.
Probably good to log2logstash here?
There was a problem hiding this comment.
I'll add log2logstash in another PR.
| $user->user_email | ||
| ); | ||
|
|
||
| Email::send( $user_id, $admin_email, $subject, 'privileged-user-created', [ |
There was a problem hiding this comment.
Probably good to also log2logstash here?
|
I got when trying to add an admin role. Changing |
@brunobasto I think you got the old code, can you try pulling again? |
Ah, yeah. Sorry about that. Works now! |
Description
Added ability to send a notification to the
Administration Email Addressset in wp-admin when a new administrator user is created.Pre-review checklist
Please make sure the items below have been covered before requesting a review:
Pre-deploy checklist
Steps to Test
Requires https://github.com/Automattic/vip-go-api/pull/6269
notify-privileged-activitymodulevip dev-env exec --slug=vip-security-boost -- wp user generate --count=1 --role=administrator