PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
8.0.5 8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 All 47 releases
← All changes | integrations/wpdiscuz/includes/functions.php +33 -0 7.9.2 → 8.0.5 View file →
@@ -1,0 +1,33 @@
1 +<?php
2 +/**
3 + * Functions
4 + *
5 + * @package GamiPress\wpDiscuz\Functions
6 + * @since 1.0.0
7 + */
8 +// Exit if accessed directly
9 +if( !defined( 'ABSPATH' ) ) exit;
10 +
11 +/**
12 + * Get the comment user ID
13 + *
14 + * @param WP_Comment $comment
15 + *
16 + * @return int
17 + */
18 +function gamipress_wpdiscuz_get_commment_user_id( $comment ) {
19 +
20 + $user_id = absint( $comment->user_id );
21 +
22 + // 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
23 + if ( $user_id === 0 && wpDiscuz()->options->login["isUserByEmail"] ) {
24 +
25 + // Get the user by email
26 + $user = get_user_by( 'email', $comment->comment_author_email );
27 +
28 + if ($user)
29 + $user_id = $user->ID;
30 + }
31 +
32 + return absint( $user_id );
33 +}