# automatorwp/6.0.3/integrations/wordpress/triggers/login.php

AutomatorWP – No-Code Workflow Automation, Integration &amp; Webhooks Plugin, now with AI, version 6.0.3. 78 lines.

- Page: https://pluginprobe.com/plugins/automatorwp/6.0.3/code/integrations/wordpress/triggers/login.php
- Raw: https://pluginprobe.com/plugins/automatorwp/6.0.3/raw/integrations/wordpress/triggers/login.php
- Modified: 2026-09-30T10:02:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/automatorwp/6.0.3/code/integrations/wordpress/triggers/login.php#L10-L20`.

```php
<?php
/**
 * Login
 *
 * @package     AutomatorWP\Integrations\WordPress\Triggers\Login
 * @author      AutomatorWP <contact@automatorwp.com>, Ruben Garcia <rubengcdev@gmail.com>
 * @since       1.0.0
 */
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;

class AutomatorWP_WordPress_Login extends AutomatorWP_Integration_Trigger {

    /**
     * Initialize the trigger
     *
     * @since 1.0.0
     */
    public function __construct( $integration ) {

        $this->integration = $integration;
        $this->trigger = $integration . '_login';

        parent::__construct();

    }

    /**
     * Register the trigger
     *
     * @since 1.0.0
     */
    public function register() {

        automatorwp_register_trigger( $this->trigger, array(
            'integration'       => $this->integration,
            'label'             => __( 'User logs in to the site', 'automatorwp' ),
            'select_option'     => __( 'User <strong>logs in</strong> to the site', 'automatorwp' ),
            /* translators: %1$s: Number of times. */
            'edit_label'        => sprintf( __( 'User logs in %1$s time(s)', 'automatorwp' ), '{times}' ),
            'log_label'         => __( 'User logs in', 'automatorwp' ),
            'action'            => 'wp_login',
            'function'          => array( $this, 'listener' ),
            'priority'          => 10,
            'accepted_args'     => 2,
            'options'           => array(
                'times' => automatorwp_utilities_times_option()
            ),
            'tags' => array(
                'times' => automatorwp_utilities_times_tag( true )
            )
        ) );

    }

    /**
     * Trigger listener
     *
     * @since 1.0.0
     *
     * @param string $user_login
     * @param WP_User $user
     */
    public function listener( $user_login, $user ) {

        $user_id = $user->ID;

        automatorwp_trigger_event( array(
            'trigger' => $this->trigger,
            'user_id' => $user_id,
        ) );

    }

}

new AutomatorWP_WordPress_Login( 'wordpress' );
new AutomatorWP_WordPress_Login( 'users' );
```
