• this plugin stopped working, and I have had to make changes to it to get it going again – posted here to help others !

    These changes the api URL to https://api.linkedin.com/v2/me to conform with V2, and take out the ‘sharing’ scope whoch is not allowed under default access (you need a partnership set-up to get this, which we don’t need!)

    \linkedin-login.1.1.3\linkedin-login\includes\lib\PkliLogin.php

    line 25 changed to
    const _BASE_URL = 'https://api.linkedin.com/v2/me';

    around line 217 changed to
    `// Get first name, last name and email address, and user picture
    $xml = $this->oauth->get(‘https://api.linkedin.com/v2/me’) ;
    $xml = json_decode($xml);
    $email_data = $this->oauth->get(‘https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))’);
    $email_data = json_decode($email_data);
    $profile_pic = $this->oauth->get(‘https://api.linkedin.com/v2/me?projection=(id,profilePicture(displayImage~:playableStreams))’) ;
    $profile_pic = json_decode($profile_pic);
    $locale_lastName = $xml->lastName->preferredLocale->language.’_’.$xml->lastName->preferredLocale->country;
    $lastName = $xml->lastName->localized->$locale_lastName;

    $locale_firstName = $xml->firstName->preferredLocale->language.’_’.$xml->firstName->preferredLocale->country;
    $firstName = $xml->firstName->localized->$locale_firstName;

    $data = [
    ‘id’=>$xml->id,
    ‘first-name’=>$firstName,
    ‘last-name’=>$lastName,
    ’email-address’=>$email_data->elements[0]->{‘handle~’}->{’emailAddress’},
    ‘picture-url’=>$profile_pic->profilePicture->{‘displayImage~’}->elements[0]->identifiers[0]->identifier,
    ];

    return (object)$data;`

    linkedin-login.1.1.3\linkedin-login\includes\lib\class-pkli-scopes.php

    line 29 commented OUT

    //const SHARING = 'w_member_social';

    \linkedin-login.1.1.3\linkedin-login\includes\lib\class-pkli-settings.php
    line 181 commented OUT to prevent error
    // Pkli_Scopes::SHARING => 'Share',

    • This topic was modified 5 years, 6 months ago by Robin W.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Plugin no longer works with v2 and how to fix’ is closed to new replies.