I could find nothing on how to get this using a plugin so I wrote my own.
​
CREATE TABLE wp_activated_plugins_log ( id int(11) NOT NULL AUTO_INCREMENT, plugin varchar(255) NOT NULL, user_id int(11) NOT NULL, date_activated datetime NOT NULL, PRIMARY KEY (id) );
add_action(‘activated_plugin’, ‘log_activated_plugin’, 10, 2);
function log_activated_plugin($plugin, $network_wide) {
global $wpdb;
$table_name = $wpdb->prefix . ‘activated_plugins_log’;
$user_id = get_current_user_id();
$date_activated = current_time(‘mysql’);
$wpdb->insert(
$table_name,
array(
‘plugin’ => $plugin,
‘user_id’ => $user_id,
‘date_activated’ => $date_activated
),
array(
‘%s’,
‘%d’,
‘%s’
)
);
}
Hope this helps someone
[ad_2]
Most of use use existing systems for this. Myself, I have 3 systems (love some log redundancy) that log activity. Don’t necessarily want it stored long term in the DB though. Install [WP activity log](https://wordpress.org/plugins/wp-security-audit-log/) and set it to geek with auto delete logs every 3-6 months.