Plugin Directory

Changeset 2390347


Ignore:
Timestamp:
09/29/2020 02:26:07 PM (6 years ago)
Author:
evnix
Message:

Release V1.1 - Add avatar and banner/logo

Location:
codoforum-sso
Files:
9 added
3 edited

Legend:

Unmodified
Added
Removed
  • codoforum-sso/trunk/License.txt

    r1034221 r2390347  
    1 Copyright (c) 2014 Codologic
     1Copyright (c) 2020 Codologic
    22
    33Permission is hereby granted, free of charge, to any person obtaining
  • codoforum-sso/trunk/readme.txt

    r1812187 r2390347  
    11=== codoforum-sso ===
    22Contributors: evnix
    3 Tags: SSO, forum
     3Tags: SSO, forum,codoforum
    44Requires at least: 3.1
    5 Tested up to: 4.9.2
    6 Stable tag: trunk
     5Tested up to: 5.5.1
     6Stable tag: 1.1.0
    77License: MIT License
    88License URI: https://github.com/evnix/wordpress-codoforum-sso/blob/master/License.txt
     
    2424Note: Make Sure you have enabled the SSO plugin in Codoforum Software.
    2525
     26
     27Enter the following details:
     28Assuming your wordpress website is installed at:
     29https://myamazingsite.com
     30
     31Your settings will be like this:
     32
     33SSO Get User Path:
     34https://myamazingsite.com/?codoforum=sso
     35
     36SSO Login User Path:
     37https://myamazingsite.com/wp-login.php
     38
     39SSO Logout User Path:
     40https://myamazingsite.com/wp-login.php?action=logout
     41
     42SSO Register User Path:
     43https://myamazingsite.com/wp-login.php?action=register
     44
     45
    2646For any further detailed documentation or help, refer: https://codoforum.com
  • codoforum-sso/trunk/wordpress-codoforum-sso.php

    r1034221 r2390347  
    22/**
    33 * @package codoforum-sso
    4  * @version 1.0
     4 * @version 1.1
    55 */
    66/*
     
    88  Description: This is a wordpress plugin to integrate wordpress with codoforum.
    99  Author: Codologic
    10   Version: 1.0
     10  Version: 1.1
    1111  Author URI: http://codoforum.com/
    1212 */
     
    6565
    6666function init_codoforum_sso() {
    67     if (is_user_logged_in() && isset($_GET['codoforum']) && $_GET['codoforum'] == 'sso') {
     67    if (!isset($_GET['codoforum']) || !$_GET['codoforum'] == 'sso') return;
    6868
     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);
    6981
    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()) {
    9184        $current_user = wp_get_current_user();
    9285        $account['uid'] = $current_user->ID; //Your logged in user's userid
    9386        $account['name'] = $current_user->user_login; //Your logged in user's username
    9487        $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    }
    9690
    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;
    10293}
    10394
Note: See TracChangeset for help on using the changeset viewer.