PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
← All changes | integrations/automatorwp/automations/all-users.php +66 -0 5.7.9 → 6.0.3 View file →
@@ -1,0 +1,66 @@
1 +<?php
2 +/**
3 + * All Users
4 + *
5 + * @package AutomatorWP\Integrations\WordPress\Automations\All_Users
6 + * @author AutomatorWP <[email protected]>, Ruben Garcia <[email protected]>
7 + * @since 1.0.0
8 + */
9 +// Exit if accessed directly
10 +if( !defined( 'ABSPATH' ) ) exit;
11 +
12 +class AutomatorWP_All_Users_Automation extends AutomatorWP_Automation_Loop {
13 +
14 + public $integration = 'automatorwp';
15 + public $type = 'all-users';
16 +
17 + public function register() {
18 +
19 + // Automation type args
20 + $this->args = array(
21 + 'image' => AUTOMATORWP_URL . 'assets/img/automatorwp-all-users-logo.svg',
22 + 'label' => __( 'All users', 'automatorwp' ),
23 + 'desc' => __( 'Run actions on a filtered group of users.', 'automatorwp' ),
24 + // Automation loop specific args
25 + 'labels' => array(
26 + 'singular' => __( 'User', 'automatorwp' ),
27 + 'plural' => __( 'Users', 'automatorwp' ),
28 + ),
29 + 'required_trigger' => 'automatorwp_all_users',
30 + );
31 + }
32 +
33 + public function process_items( $items_ids, $automation, $trigger, $trigger_options ) {
34 +
35 + global $automatorwp_event;
36 +
37 + // Set up a false event since the following functions require it
38 + $automatorwp_event = array(
39 + 'user_id' => 0
40 + );
41 +
42 + foreach ( $items_ids as $items_id ) {
43 +
44 + $user_id = absint( $items_id );
45 + $automatorwp_event['user_id'] = $user_id;
46 +
47 + foreach( $trigger_options as $option => $value ) {
48 + // Replace all tags by their replacements
49 + $trigger_options[$option] = automatorwp_parse_automation_tags( $automation->id, $user_id, $value );
50 + }
51 +
52 + // Check if user deserves the trigger filters
53 + if( ! automatorwp_user_deserves_trigger_filters( $trigger, $user_id, $automatorwp_event, $trigger_options, $automation ) ) {
54 + continue;
55 + }
56 +
57 + // Execute all automation actions
58 + automatorwp_execute_all_automation_actions( $automation, $user_id, $automatorwp_event );
59 +
60 + }
61 +
62 + }
63 +
64 +}
65 +
66 +new AutomatorWP_All_Users_Automation();