# gamipress/8.0.2/integrations/wpdiscuz/includes/functions.php

GamiPress – Gamification plugin to reward points, badges &amp; ranks in WordPress, now with AI, version 8.0.2. 33 lines.

- Page: https://pluginprobe.com/plugins/gamipress/8.0.2/code/integrations/wpdiscuz/includes/functions.php
- Raw: https://pluginprobe.com/plugins/gamipress/8.0.2/raw/integrations/wpdiscuz/includes/functions.php
- Modified: 2026-09-14T11:54:16+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/gamipress/8.0.2/code/integrations/wpdiscuz/includes/functions.php#L10-L20`.

```php
<?php
/**
 * Functions
 *
 * @package GamiPress\wpDiscuz\Functions
 * @since 1.0.0
 */
// Exit if accessed directly
if( !defined( 'ABSPATH' ) ) exit;

/**
 * Get the comment user ID
 *
 * @param WP_Comment $comment
 *
 * @return int
 */
function gamipress_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 );
}
```
