Plugin Directory

Changeset 1822317


Ignore:
Timestamp:
02/14/2018 08:38:07 PM (8 years ago)
Author:
MVR
Message:

tagging version 1.0.12

Location:
userecho
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • userecho/tags/1.0.12/readme.txt

    r1822254 r1822317  
    55Requires at least: 2.8
    66Tested up to: 4.9.4
    7 Stable tag: 1.0.11
     7Stable tag: 1.0.12
    88
    99Integrate UserEcho - customer feedback and helpdesk system into your blog. Using widget or link. Support SSO.
     
    4545== Changelog ==
    4646
     47= 1.0.12 =
     48* SSO integration - fix bugs in some specific cases
    4749= 1.0.11 =
    4850* SSO integration - mcrypt module is deprecated in php 7.2.0 (replace with openssl)
  • userecho/tags/1.0.12/userecho.php

    r1822254 r1822317  
    22/*
    33Plugin Name: UserEcho for Wordpress - collect feedback for your blog
    4 Version: 1.0.11
     4Version: 1.0.12
    55Plugin URI: https://userecho.com
    66Author: UserEcho
     
    2727define( 'UE_URL', plugins_url() . '/userecho' );
    2828
     29if(!function_exists('wp_get_current_user')) {
     30    require_once ABSPATH . "wp-includes/pluggable.php";
     31}
     32
    2933class UserEcho {
     34    public $current_user = 0;
    3035    public function __construct() {
    3136        $this->check_if_sso_login();
     
    3540        add_action( 'wp_footer', array( $this, 'show_tab_widget' ) );
    3641
     42    }
     43    public function get_current_user(){
     44        #global $current_user;
     45        if (empty( $this->$current_user->ID )){
     46            $this->$current_user = wp_get_current_user();
     47        }
     48        return $this->$current_user;
    3749    }
    3850
     
    300312
    301313    private function get_sso_token() {
    302         global $current_user;
     314        $current_user = $this->get_current_user();
    303315        $options = $this->get_options();
    304316
     
    387399    public function check_if_sso_login()
    388400        {
    389         global $current_user, $pagenow;
    390401        #http://127.0.0.1/wordpress/wp-login.php
    391402        # http://127.0.0.1/wordpress/wp-login.php?host_url=https://userecho.com&action=ue-login
    392 
    393403        if ( isset( $_GET['action'] ) && $_GET['action'] == 'ue-login' ) {
    394404            if ( ! isset( $_REQUEST['return']) || ! $_REQUEST['return'] ) {
     
    397407            $return_url = $_REQUEST['return'];
    398408
    399             if ( !empty( $current_user->ID) ) {
     409            if ( !empty( $this->get_current_user()->ID) ) {
    400410                // If user is logged into WP, generate SSO and redirect him back to UE
    401411                header( 'Location: '.$this->get_sso_redirect_url($return_url) ) ;
     
    529539        return $url;
    530540    }
    531 
    532     if (isset( $_REQUEST['wp-submit'] ) && $_REQUEST['wp-submit'] == "Log In" && is_a( $user, 'WP_User' )) {
     541    #if (isset( $_REQUEST['wp-submit'] ) && $_REQUEST['wp-submit'] == "Log In" && is_a( $user, 'WP_User' )) {
     542    if (is_a( $user, 'WP_User' )) {
     543        $ue->$current_user = $user;
    533544        header("Location: ".$ue->get_sso_redirect_url($return_url));
    534545        die();
  • userecho/trunk/readme.txt

    r1822254 r1822317  
    55Requires at least: 2.8
    66Tested up to: 4.9.4
    7 Stable tag: 1.0.11
     7Stable tag: 1.0.12
    88
    99Integrate UserEcho - customer feedback and helpdesk system into your blog. Using widget or link. Support SSO.
     
    4545== Changelog ==
    4646
     47= 1.0.12 =
     48* SSO integration - fix bugs in some specific cases
    4749= 1.0.11 =
    4850* SSO integration - mcrypt module is deprecated in php 7.2.0 (replace with openssl)
  • userecho/trunk/userecho.php

    r1822254 r1822317  
    22/*
    33Plugin Name: UserEcho for Wordpress - collect feedback for your blog
    4 Version: 1.0.11
     4Version: 1.0.12
    55Plugin URI: https://userecho.com
    66Author: UserEcho
     
    2727define( 'UE_URL', plugins_url() . '/userecho' );
    2828
     29if(!function_exists('wp_get_current_user')) {
     30    require_once ABSPATH . "wp-includes/pluggable.php";
     31}
     32
    2933class UserEcho {
     34    public $current_user = 0;
    3035    public function __construct() {
    3136        $this->check_if_sso_login();
     
    3540        add_action( 'wp_footer', array( $this, 'show_tab_widget' ) );
    3641
     42    }
     43    public function get_current_user(){
     44        #global $current_user;
     45        if (empty( $this->$current_user->ID )){
     46            $this->$current_user = wp_get_current_user();
     47        }
     48        return $this->$current_user;
    3749    }
    3850
     
    300312
    301313    private function get_sso_token() {
    302         global $current_user;
     314        $current_user = $this->get_current_user();
    303315        $options = $this->get_options();
    304316
     
    387399    public function check_if_sso_login()
    388400        {
    389         global $current_user, $pagenow;
    390401        #http://127.0.0.1/wordpress/wp-login.php
    391402        # http://127.0.0.1/wordpress/wp-login.php?host_url=https://userecho.com&action=ue-login
    392 
    393403        if ( isset( $_GET['action'] ) && $_GET['action'] == 'ue-login' ) {
    394404            if ( ! isset( $_REQUEST['return']) || ! $_REQUEST['return'] ) {
     
    397407            $return_url = $_REQUEST['return'];
    398408
    399             if ( !empty( $current_user->ID) ) {
     409            if ( !empty( $this->get_current_user()->ID) ) {
    400410                // If user is logged into WP, generate SSO and redirect him back to UE
    401411                header( 'Location: '.$this->get_sso_redirect_url($return_url) ) ;
     
    529539        return $url;
    530540    }
    531 
    532     if (isset( $_REQUEST['wp-submit'] ) && $_REQUEST['wp-submit'] == "Log In" && is_a( $user, 'WP_User' )) {
     541    #if (isset( $_REQUEST['wp-submit'] ) && $_REQUEST['wp-submit'] == "Log In" && is_a( $user, 'WP_User' )) {
     542    if (is_a( $user, 'WP_User' )) {
     543        $ue->$current_user = $user;
    533544        header("Location: ".$ue->get_sso_redirect_url($return_url));
    534545        die();
Note: See TracChangeset for help on using the changeset viewer.