Plugin Directory

Changeset 1004796


Ignore:
Timestamp:
10/09/2014 10:14:06 PM (11 years ago)
Author:
miled
Message:
  • Get full avatar form LinkedIn
  • Get LinkedIn members headline as description. Summary no longer work
Location:
wordpress-social-login
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wordpress-social-login/tags/2.2.2/hybridauth/Hybrid/Providers/LinkedIn.php

    r1002140 r1004796  
    5151        }
    5252        else{
    53             throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token.", 5 );
     53            throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token:" . print_r( $response, true ), 5 );
    5454        }
    5555    }
     
    6464
    6565        if ( ! $oauth_verifier ){
    66             throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token.", 5 );
     66            throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token:" . htmlentities( print_r( $_REQUEST, true ) ), 5 );
    6767        }
    6868
     
    8181        }
    8282        else{
    83             throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token.", 5 );
     83            throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token:" . print_r( $response, true ), 5 );
    8484        }
    8585    }
     
    9292        try{
    9393            // http://developer.linkedin.com/docs/DOC-1061
    94             $response = $this->api->profile('~:(id,first-name,last-name,public-profile-url,picture-url,email-address,date-of-birth,phone-numbers,summary)');
     94            $response = $this->api->profile('~:(id,first-name,last-name,public-profile-url,picture-url,picture-urls::(original),email-address,date-of-birth,phone-numbers,headline)');
    9595        }
    9696        catch( LinkedInException $e ){
     
    115115            $this->user->profile->photoURL    = (string) $data->{'picture-url'};
    116116            $this->user->profile->profileURL  = (string) $data->{'public-profile-url'};
    117             $this->user->profile->description = (string) $data->{'summary'};
     117            $this->user->profile->description = (string) $data->{'headline'};
    118118
    119119            if( $data->{'phone-numbers'} && $data->{'phone-numbers'}->{'phone-number'} ){
     
    128128                $this->user->profile->birthMonth = (string) $data->{'date-of-birth'}->month;
    129129                $this->user->profile->birthYear  = (string) $data->{'date-of-birth'}->year;
     130            }
     131
     132            if( (string) $data->{'picture-urls'}->{'picture-url'} ){
     133                $this->user->profile->photoURL  = (string) $data->{'picture-urls'}->{'picture-url'};
    130134            }
    131135
  • wordpress-social-login/trunk/hybridauth/Hybrid/Providers/LinkedIn.php

    r1002140 r1004796  
    5151        }
    5252        else{
    53             throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token.", 5 );
     53            throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token:" . print_r( $response, true ), 5 );
    5454        }
    5555    }
     
    6464
    6565        if ( ! $oauth_verifier ){
    66             throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token.", 5 );
     66            throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token:" . htmlentities( print_r( $_REQUEST, true ) ), 5 );
    6767        }
    6868
     
    8181        }
    8282        else{
    83             throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token.", 5 );
     83            throw new Exception( "Authentication failed! {$this->providerId} returned an invalid Token:" . print_r( $response, true ), 5 );
    8484        }
    8585    }
     
    9292        try{
    9393            // http://developer.linkedin.com/docs/DOC-1061
    94             $response = $this->api->profile('~:(id,first-name,last-name,public-profile-url,picture-url,email-address,date-of-birth,phone-numbers,summary)');
     94            $response = $this->api->profile('~:(id,first-name,last-name,public-profile-url,picture-url,picture-urls::(original),email-address,date-of-birth,phone-numbers,headline)');
    9595        }
    9696        catch( LinkedInException $e ){
     
    115115            $this->user->profile->photoURL    = (string) $data->{'picture-url'};
    116116            $this->user->profile->profileURL  = (string) $data->{'public-profile-url'};
    117             $this->user->profile->description = (string) $data->{'summary'};
     117            $this->user->profile->description = (string) $data->{'headline'};
    118118
    119119            if( $data->{'phone-numbers'} && $data->{'phone-numbers'}->{'phone-number'} ){
     
    128128                $this->user->profile->birthMonth = (string) $data->{'date-of-birth'}->month;
    129129                $this->user->profile->birthYear  = (string) $data->{'date-of-birth'}->year;
     130            }
     131
     132            if( (string) $data->{'picture-urls'}->{'picture-url'} ){
     133                $this->user->profile->photoURL  = (string) $data->{'picture-urls'}->{'picture-url'};
    130134            }
    131135
Note: See TracChangeset for help on using the changeset viewer.