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/wordpress/triggers/user-password-reset.php +79 -0 5.7.3 → 6.0.3 View file →
@@ -1,0 +1,79 @@
1 +<?php
2 +/**
3 + * User Password Reset
4 + *
5 + * @package AutomatorWP\Integrations\WordPress\Triggers\User_Password_Reset
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_WordPress_User_Password_Reset extends AutomatorWP_Integration_Trigger {
13 +
14 + /**
15 + * Initialize the trigger
16 + *
17 + * @since 1.0.0
18 + */
19 + public function __construct( $integration ) {
20 +
21 + $this->integration = $integration;
22 + $this->trigger = $integration . '_user_password_reset';
23 +
24 + parent::__construct();
25 +
26 + }
27 +
28 + /**
29 + * Register the trigger
30 + *
31 + * @since 1.0.0
32 + */
33 + public function register() {
34 +
35 + automatorwp_register_trigger( $this->trigger, array(
36 + 'integration' => $this->integration,
37 + 'label' => __( 'User resets their password', 'automatorwp' ),
38 + 'select_option' => __( 'User resets their <strong>password</strong>', 'automatorwp' ),
39 + /* translators: %1$s: Number of times. */
40 + 'edit_label' => sprintf( __( 'User resets their password %1$s time(s)', 'automatorwp' ), '{times}' ),
41 + 'log_label' => __( 'User resets their password', 'automatorwp' ),
42 + 'action' => array(
43 + 'after_password_reset',
44 + 'woocommerce_customer_reset_password'
45 + ),
46 + 'function' => array( $this, 'listener' ),
47 + 'priority' => 10,
48 + 'accepted_args' => 2,
49 + 'options' => array(
50 + 'times' => automatorwp_utilities_times_option(),
51 + ),
52 + 'tags' => array_merge(
53 + automatorwp_utilities_times_tag()
54 + )
55 + ) );
56 +
57 + }
58 +
59 + /**
60 + * Trigger listener
61 + *
62 + * @since 1.0.0
63 + *
64 + * @param WP_User $user The user.
65 + * @param string $new_pass New user password.
66 + */
67 + public function listener( $user, $new_pass ) {
68 +
69 + automatorwp_trigger_event( array(
70 + 'trigger' => $this->trigger,
71 + 'user_id' => $user->ID,
72 + ) );
73 +
74 + }
75 +
76 +}
77 +
78 +new AutomatorWP_WordPress_User_Password_Reset( 'wordpress' );
79 +new AutomatorWP_WordPress_User_Password_Reset( 'users' );