Plugin Directory

Changeset 2768101


Ignore:
Timestamp:
08/09/2022 12:33:20 AM (4 years ago)
Author:
winrid
Message:

3.12.4 - Fixing Malformed SSO message shown when SSO is enabled and nobody is logged in. The "login to comment" option is now shown as expected.

Location:
fastcomments
Files:
40 added
3 edited

Legend:

Unmodified
Added
Removed
  • fastcomments/trunk/README.txt

    r2752858 r2768101  
    44Requires at least: 4.6
    55Tested up to: 6.0
    6 Stable tag: 3.12.3
     6Stable tag: 3.12.4
    77Requires PHP: 5.2.5
    88License: GPLv2 or later
     
    8888== Changelog ==
    8989
     90= 3.12.4 =
     91* Fixing Malformed SSO message shown when SSO is enabled and nobody is logged in. The "login to comment" option is now shown as expected.
     92
    9093= 3.12.3 =
    9194* Decreasing time to wait in some cases after setup complete.
  • fastcomments/trunk/fastcomments-wordpress-plugin.php

    r2752858 r2768101  
    1414}
    1515
    16 $FASTCOMMENTS_VERSION = 3.123;
     16$FASTCOMMENTS_VERSION = 3.124;
    1717
    1818require_once plugin_dir_path(__FILE__) . 'admin/fastcomments-admin.php';
  • fastcomments/trunk/public/fastcomments-public.php

    r2744374 r2768101  
    9898                foreach ($get_comments_response->comments as $comment) {
    9999                    $wp_comment = $fastcomments->fc_to_wp_comment($comment, true);
    100                     if(!wp_update_comment($wp_comment)) {
     100                    if (!wp_update_comment($wp_comment)) {
    101101                        wp_insert_comment($wp_comment);
    102102                    }
     
    162162        $result['timestamp'] = $timestamp;
    163163
    164         $is_admin = current_user_can('administrator');
    165         $is_moderator = current_user_can('moderate_comments');
    166 
    167         $sso_user = array();
    168         if ($wp_user) {
     164        if ($wp_user && ($wp_user->user_email || $wp_user->display_name)) {
     165            $sso_user = array();
     166            $is_admin = current_user_can('administrator');
     167            $is_moderator = current_user_can('moderate_comments');
    169168            $sso_user['id'] = $wp_user->ID;
    170             $sso_user['email'] = $wp_user->user_email;
    171             $sso_user['username'] = $wp_user->display_name;
    172             $sso_user['avatar'] = get_avatar_url($wp_user->ID, 95);
     169            if ($wp_user->user_email) {
     170                $sso_user['email'] = $wp_user->user_email;
     171            }
     172            if ($wp_user->display_name) {
     173                $sso_user['username'] = $wp_user->display_name;
     174            }
     175            $avatar_url = get_avatar_url($wp_user->ID, 95);
     176            if ($avatar_url) {
     177                $sso_user['avatar'] = $avatar_url;
     178            }
    173179            $sso_user['optedInNotifications'] = true;
    174180            $sso_user['isAdmin'] = $is_admin;
    175181            $sso_user['isModerator'] = $is_moderator;
     182            $userDataJSONBase64 = base64_encode(json_encode($sso_user));
     183            $verificationHash = hash_hmac('sha256', $timestamp . $userDataJSONBase64, $ssoKey);
     184
     185            $result['userDataJSONBase64'] = $userDataJSONBase64;
     186            $result['verificationHash'] = $verificationHash;
    176187        }
    177 
    178         $userDataJSONBase64 = base64_encode(json_encode($sso_user));
    179         $verificationHash = hash_hmac('sha256', $timestamp . $userDataJSONBase64, $ssoKey);
    180 
    181         $result['userDataJSONBase64'] = $userDataJSONBase64;
    182         $result['verificationHash'] = $verificationHash;
    183188        $result['loginURL'] = wp_login_url();
    184189        $result['logoutURL'] = wp_logout_url();
Note: See TracChangeset for help on using the changeset viewer.