Changeset 1711815
- Timestamp:
- 08/10/2017 10:38:10 PM (9 years ago)
- Location:
- chatwee/trunk
- Files:
-
- 3 edited
-
chatwee.php (modified) (8 diffs)
-
lib/ChatweeV2_SDK/Chatwee/SsoUser.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
chatwee/trunk/chatwee.php
r1595247 r1711815 73 73 74 74 dbDelta($create_pages_to_display_table_clause); 75 75 76 76 77 77 update_option("chatwee_settings", get_default_chatwee_settings()); … … 82 82 83 83 $id = get_the_ID(); 84 84 85 85 $categories_to_display = $chatwee_settings["categories_to_display"]; 86 86 87 87 $main_page_matched = is_array($categories_to_display) && in_array("main_page", $categories_to_display) && is_home() === true; 88 88 $search_page_matched = is_array($categories_to_display) && in_array("search_page", $categories_to_display) && is_search() === true; … … 157 157 } 158 158 159 if($chatwee_settings["enable_sso"] === true && is_user_logged_in() === true && ChatweeV2_Session::isSessionSet() === false) { 160 login_v2(wp_get_current_user()); 159 try { 160 if($chatwee_settings["enable_sso"] === true && is_user_logged_in() === true) { 161 if(ChatweeV2_Session::isSessionSet() === false) { 162 login_v2(wp_get_current_user()); 163 } else { 164 $sessionId = ChatweeV2_Session::getSessionId(); 165 166 $isSessionValid = ChatweeV2_SsoUser::validateSession(Array( 167 "sessionId" => $sessionId 168 )); 169 170 if($isSessionValid === false) { 171 login_v2(wp_get_current_user()); 172 } 173 } 174 } 175 } catch(Exception $exception) { 176 add_log("Error while reinitializng SSO session: " . $exception->getMessage()); 161 177 } 162 178 } 163 179 164 180 function init_handler() { 181 if(wp_doing_ajax() === true) { 182 return false; 183 } 184 165 185 $chatwee_settings = get_option("chatwee_settings"); 166 186 … … 178 198 $chatwee_settings = get_option("chatwee_settings"); 179 199 180 if( ChatweeV1_User::isLogged() === false && $chatwee_settings["disable_offline_users"] === true) {200 if(is_user_logged_in() === false && $chatwee_settings["disable_offline_users"] === true) { 181 201 return false; 182 202 } … … 189 209 $chatwee_settings = get_option("chatwee_settings"); 190 210 191 if( ChatweeV2_Session::isSessionSet() === false && $chatwee_settings["disable_offline_users"] === true) {211 if(is_user_logged_in() === false && $chatwee_settings["disable_offline_users"] === true) { 192 212 return false; 193 213 } … … 251 271 add_log("Error: " . $exception->getMessage()); 252 272 } 253 } elseif ($has_been_promoted_as_chatwee_moderator_on_wordpress == false && $has_been_set_as_moderator_on_chatwee == 1) { 273 } elseif ($has_been_promoted_as_chatwee_moderator_on_wordpress == false && $has_been_set_as_moderator_on_chatwee == 1) { 254 274 try { 255 275 ChatweeV2_SsoUser::edit(Array( … … 325 345 326 346 function register_v2($user) { 327 347 328 348 $username = $user->display_name ? $user->display_name : $user->user_login; 329 349 … … 382 402 function user_edit_handler($user_id) { 383 403 $user = get_user_by("id", $user_id); 384 404 385 405 edit_v2($user); 386 406 } -
chatwee/trunk/lib/ChatweeV2_SDK/Chatwee/SsoUser.php
r1595247 r1711815 40 40 } 41 41 42 public static function validateSession($parameters) { 43 $requestParameters = Array( 44 "sessionId" => $parameters["sessionId"] 45 ); 46 47 $httpClient = new ChatweeV2_HttpClient(); 48 $httpClient->get("sso-user/validate-session", $requestParameters); 49 50 $validationResponse = $httpClient->getResponseObject(); 51 52 return $validationResponse; 53 } 54 42 55 public static function logout($parameters) { 43 56 $requestParameters = Array( -
chatwee/trunk/readme.txt
r1616245 r1711815 41 41 = Resources = 42 42 * To use the plugin, please [sign up](https://client.chatwee.com/v2/dashboard) with us first. It’s free and you’ll need access to the installation code, in order to get this plugin to work. 43 * [WordPress chat plugin installation instruction](https://chatwee.com/wordpress-chat-plugin-installation) 43 * [WordPress chat plugin installation instruction](https://chatwee.com/wordpress-chat-plugin-installation) 44 44 * [Chatwee 2.0 features](https://chatwee.com/full-features) / [Chatwee 1.0 features](https://v1.chatwee.com/features) 45 45 * [Chatwee 2.0 support center](https://chatwee.com/support) / [Chatwee 1.0 support center](https://support.chatwee.com)
Note: See TracChangeset
for help on using the changeset viewer.