Repository navigation
enhancement(log): add a network-wide email log for multisite - #109
faisalahammad wants to merge 3 commits into
Conversation
- Add Settings > SMTP Log to the network admin, for super admins - Join the log table of every site with one UNION ALL query - Add a Site column, status links and a site filter - Skip sites without a log table Fixes WordPress#84
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @leedxw. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
There was a problem hiding this comment.
🟡 Changes recommended
Explicit site IDs bypass network and active-site restrictions, allowing users authorized for one network to access another network’s email metadata.
4 open issues
What changed in this PR
Adds a read-only multisite email log under network Settings > SMTP Log, addressing #84 without requiring admins to visit each site.
Changes:
- Combines site logs with SQL-based pagination, counts and status filtering.
- Adds a network admin screen with site filtering and links to individual logs.
- Adds multisite tests and documents network activation and the 100-site limit.
| File | Description |
|---|---|
| tests/phpunit/tests/Log_Repository_Tests.php | Tests cross-site queries, filtering and pagination. |
| tests/phpunit/tests/Admin/Network_Log_Page_Tests.php | Tests menu registration, access and rendering. |
| readme.txt | Documents the feature and limitations. |
| includes/Plugin_Main.php | Registers the multisite screen. |
| includes/Log_Repository.php | Adds network table discovery and queries. |
| includes/Admin/Network_Log_Page.php | Adds the network page and site selector. |
| includes/Admin/Network_Log_List_Table.php | Displays combined logs and status links. |
| includes/Admin/Log_List_Table.php | Makes status parsing accessible to subclasses. |
| AGENTS.md | Documents the network log architecture. |
Review effort: Balanced
|
Hey @faisalahammad
Nits:
|
masteradhoc
left a comment
There was a problem hiding this comment.
@faisalahammad could you check the comments below and let us know when we can retest the PR?
- Narrow ?site= from the active site list of the current network - Discover site tables once, keep the full site list in the select - Keep the status when the site filter is used - Count per site and limit rows per site before sorting - Convert text columns so sites with different collations combine - Show a notice when the network has more than 100 sites - Reuse the parent status method and repository, soften readme Addresses PR feedback. Refs WordPress#109
|
Thanks @masteradhoc. Pushed fixes:
|


What?
Closes #84
Adds a network-wide email log for multisite, under Settings > SMTP Log in the network admin.
Why?
Super admins of a multisite network had to open Tools > SMTP on every site to check for failed emails. With more than a dozen sites this is slow, so one place to see all of them is needed.
How?
Log_Repositorygetsget_network_tables(),get_network_items()andcount_network(). The log table of each site ({site prefix}smtp_logs) is joined with oneUNION ALLquery, so sorting, paging and counts run in SQL. Sites without a log table are skipped, and only the first 100 active sites of the current network are read (a notice shows when there are more).Network_Log_Pageregisters the screen onnetwork_admin_menuwith themanage_network_optionscapability.Network_Log_List_TableextendsLog_List_Tableand adds a Site column that links to the log of that site, plus the status links and a site filter.network/tools.php. The plugin must be network activated for the screen to load.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5.5
Used for: Implementation and tests. I reviewed and tested the result.
Testing Instructions
Needs a multisite network with the plugin network activated.
/wp-admin/network/settings.php?page=smtp-network-logas a site admin who is not a super admin. Access is refused.Emails were sent with the Test tab only.
Checklist
npm run test-phppasses locally.composer lintpasses.I also ran
npm run test-php-multisiteandcomposer phpstan, both pass.Changelog Entry