Generate an Email once Updates are done?

Our team bundle our updates across our client sites over the 5 days of the week, so 10 or 15 sites get updated each day.

I’d like to receive an email from MainWP when the updates have been done by my team for confirmation just in case a day get’s missed.

How would I go about do this in a custom snippet?

Thanks in advance.

Hey @Dave

Out of the box, you can get email notifications about available updates via the “Daily Digest” emails, or use Pro Reports to send scheduled reports (daily, weekly, monthly).

If you want to build something custom, you’d likely want to look in the direction of hooking into MainWP update actions and triggering a custom wp_mail() notification.

All available hooks and filters are documented here: https://mainwp.dev/

I did see this but the hook referenced is for when a site is synced (Fires upon successful site synchronization), not updated.

Would mainwp_website_updated be a more appropriate hook?

Hey @Dave

I will check with our dev team for more info and get back to you as soon as I can.

@Dave

We’ve just released version 6.0.2 of the MainWP Dashboard which introduces a new hook mainwp_module_logs_get_log_records.

You can use it to get all updated actions/sites, prepare a custom email, and send it to the dashboard admin.

$my_action_logs_today = apply_filters(‘mainwp_module_logs_get_log_records’, false, array(

‘contexts’ => ‘plugin,core,theme’,

‘sources_conds’ => ‘dashboard-only’,

‘events’ => array(‘activate’, ‘delete’, ‘deactivate’, ‘install’, ‘updated’ ),

‘timestart’ => strtotime(‘today UTC’),

‘timestop’ = > time()

));

After that, prepare an email for $my_action_logs_today and send to the dashboard admin.