# automatorwp/6.0.2/integrations/wpdiscuz/includes/functions.php

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

- Page: https://pluginprobe.com/plugins/automatorwp/6.0.2/code/integrations/wpdiscuz/includes/functions.php
- Raw: https://pluginprobe.com/plugins/automatorwp/6.0.2/raw/integrations/wpdiscuz/includes/functions.php
- Modified: 2026-09-14T10:29:36+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.2/code/integrations/wpdiscuz/includes/functions.php#L10-L20`.

```php
<?php
/**
 * Functions
 *
 * @package     AutomatorWP\Integrations\wpDiscuz\Functions
 * @author      AutomatorWP <contact@automatorwp.com>, Ruben Garcia <rubengcdev@gmail.com>
 * @since       1.0.0
 */
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;

/**
 * Get the comment user ID
 *
 * @param WP_Comment $comment
 *
 * @return int
 */
function automatorwp_wpdiscuz_get_commment_user_id( $comment ) {

    $user_id = absint( $comment->user_id );

    // If comment has not assigned a user id and wpDiscuz is configured to use the user email, then need to search this user by email
    if ( $user_id === 0 && wpDiscuz()->options->login["isUserByEmail"] ) {

        // Get the user by email
        $user = get_user_by( 'email', $comment->comment_author_email );

        if ( $user ) {
            $user_id = $user->ID;
        }
    }

    return absint( $user_id );
}
```
