PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.3
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.3
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
adminify / Inc / Modules / ActivityLogs / Hooks / WP_Adminify_Logs_Taxonomy.php

WP_Adminify_Logs_Taxonomy.php in Adminify – White Label, Admin Menu Editor, Login Customizer 2.0.3, at Inc/Modules/ActivityLogs/Hooks/WP_Adminify_Logs_Taxonomy.php

52 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPAdminify\Inc\Modules\ActivityLogs\Hooks;
4
5 use WPAdminify\Inc\Modules\ActivityLogs\Inc\Hooks_Base;
6
7 // no direct access allowed
8 if (!defined('ABSPATH')) exit;
9
10 class WP_Adminify_Logs_Taxonomy extends Hooks_Base
11 {
12 public function __construct()
13 {
14 parent::__construct();
15 add_action('created_term', [$this, 'hooks_created_edited_deleted_term'], 10, 3);
16 add_action('edited_term', [$this, 'hooks_created_edited_deleted_term'], 10, 3);
17 add_action('delete_term', [$this, 'hooks_created_edited_deleted_term'], 10, 4);
18 }
19
20
21 public function hooks_created_edited_deleted_term($term_id, $tt_id, $taxonomy, $deleted_term = null)
22 {
23 // Make sure do not action nav menu taxonomy.
24 if ('nav_menu' === $taxonomy)
25 return;
26
27 if ('delete_term' === current_filter())
28 $term = $deleted_term;
29 else
30 $term = get_term($term_id, $taxonomy);
31
32 if ($term && !is_wp_error($term)) {
33 if ('edited_term' === current_filter()) {
34 $action = 'updated';
35 } elseif ('delete_term' === current_filter()) {
36 $action = 'deleted';
37 $term_id = '';
38 } else {
39 $action = 'created';
40 }
41
42 adminify_activity_logs(array(
43 'action' => $action,
44 'object_type' => 'Taxonomy',
45 'object_subtype' => $taxonomy,
46 'object_id' => $term_id,
47 'object_name' => $term->name,
48 ));
49 }
50 }
51 }
52