Changeset 2390347
- Timestamp:
- 09/29/2020 02:26:07 PM (6 years ago)
- Location:
- codoforum-sso
- Files:
-
- 9 added
- 3 edited
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (added)
-
assets/icon-128x128.png (added)
-
assets/icon-256x256.png (added)
-
tags/1.1.0 (added)
-
tags/1.1.0/License.txt (added)
-
tags/1.1.0/readme.txt (added)
-
tags/1.1.0/sso.php (added)
-
tags/1.1.0/wordpress-codoforum-sso.php (added)
-
trunk/License.txt (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wordpress-codoforum-sso.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
codoforum-sso/trunk/License.txt
r1034221 r2390347 1 Copyright (c) 20 14Codologic1 Copyright (c) 2020 Codologic 2 2 3 3 Permission is hereby granted, free of charge, to any person obtaining -
codoforum-sso/trunk/readme.txt
r1812187 r2390347 1 1 === codoforum-sso === 2 2 Contributors: evnix 3 Tags: SSO, forum 3 Tags: SSO, forum,codoforum 4 4 Requires at least: 3.1 5 Tested up to: 4.9.26 Stable tag: trunk5 Tested up to: 5.5.1 6 Stable tag: 1.1.0 7 7 License: MIT License 8 8 License URI: https://github.com/evnix/wordpress-codoforum-sso/blob/master/License.txt … … 24 24 Note: Make Sure you have enabled the SSO plugin in Codoforum Software. 25 25 26 27 Enter the following details: 28 Assuming your wordpress website is installed at: 29 https://myamazingsite.com 30 31 Your settings will be like this: 32 33 SSO Get User Path: 34 https://myamazingsite.com/?codoforum=sso 35 36 SSO Login User Path: 37 https://myamazingsite.com/wp-login.php 38 39 SSO Logout User Path: 40 https://myamazingsite.com/wp-login.php?action=logout 41 42 SSO Register User Path: 43 https://myamazingsite.com/wp-login.php?action=register 44 45 26 46 For any further detailed documentation or help, refer: https://codoforum.com -
codoforum-sso/trunk/wordpress-codoforum-sso.php
r1034221 r2390347 2 2 /** 3 3 * @package codoforum-sso 4 * @version 1. 04 * @version 1.1 5 5 */ 6 6 /* … … 8 8 Description: This is a wordpress plugin to integrate wordpress with codoforum. 9 9 Author: Codologic 10 Version: 1. 010 Version: 1.1 11 11 Author URI: http://codoforum.com/ 12 12 */ … … 65 65 66 66 function init_codoforum_sso() { 67 if (is_user_logged_in() && isset($_GET['codoforum']) && $_GET['codoforum'] == 'sso') { 67 if (!isset($_GET['codoforum']) || !$_GET['codoforum'] == 'sso') return; 68 68 69 /** 70 * 71 * The SSO client id and secret MUST be same as that set in the Codoforum 72 * SSO plugin settings 73 */ 74 $settings = array( 75 "client_id" => get_option('codoforum_clientid', 'codoforum_DEFAULT'), 76 "secret" => get_option('codoforum_secret', 'codoforum_DEFAULT'), 77 "timeout" => 6000 78 ); 79 require 'sso.php'; 80 $sso = new codoforum_sso($settings); 69 81 70 require 'sso.php'; 71 72 /** 73 * 74 * The SSO client id and secret MUST be same as that set in the Codoforum 75 * SSO plugin settings 76 */ 77 $settings = array( 78 "client_id" => get_option('codoforum_clientid', 'codoforum_DEFAULT'), 79 "secret" => get_option('codoforum_secret', 'codoforum_DEFAULT'), 80 "timeout" => 6000 81 ); 82 83 $sso = new codoforum_sso($settings); 84 85 $account = array(); 86 /** 87 * 88 * Here comes your logic to check if the user is logged in or not. 89 * A simple example would be using PHP SESSION 90 */ 82 $account = []; 83 if (is_user_logged_in()) { 91 84 $current_user = wp_get_current_user(); 92 85 $account['uid'] = $current_user->ID; //Your logged in user's userid 93 86 $account['name'] = $current_user->user_login; //Your logged in user's username 94 87 $account['mail'] = $current_user->user_email; //Your logged in user's email id 95 $account['avatar'] = ''; //not used as of now 88 $account['avatar'] = get_avatar_url($current_user->ID); //not used as of now 89 } 96 90 97 $sso->output_jsonp($account); //output above as JSON back to Codoforum 98 exit(); 99 } else { 100 101 } 91 $sso->output_jsonp($account); //output JSON back to Codoforum 92 exit; 102 93 } 103 94
Note: See TracChangeset
for help on using the changeset viewer.