Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Or maybe a better way, in the previous code :

    $this->user->profile->identifier = (property_exists($response,'resourceName'))?$response->resourceName:((property_exists($response,'resourceName'))?$response->resourceName:"");
    becomes :
    $this->user->profile->identifier = str_replace("people/","",(property_exists($response,'resourceName'))?$response->resourceName:((property_exists($response,'resourceName'))?$response->resourceName:""));

    And you don’t have to update the database…

    Hi,

    I suggested a possible solution here :
    https://www.ads-software.com/support/topic/will-the-google-api-be-updated-current-one-will-stop-working-in-march/#post-11133737

    Edit : The post is not currently visible because “This post has been held for moderation by our automated system and will be manually reviewed by a moderator.”

    Hi,

    Google+ API (which will be shut down) seems to be only used to get user datas.
    The solution could be to use People API in place of Google+ API in hybridauth/Hybrid/Providers/Google.php

    I did the following modifications and it seems to be working.
    As I only need to get email, first name, last name and display name, it seems sufficient.

    Line 19 :
    public $scope = "profile https://www.googleapis.com/auth/plus.profile.emails.read";
    becomes :
    public $scope = "profile email";

    Line 29 :
    $this->api->api_base_url = "https://www.googleapis.com/plus/v1/";
    becomes :
    $this->api->api_base_url = "https://www.googleapis.com/oauth2/v1/";

    Line 73 to 101 :

    $response = $this->api->api( "https://www.googleapis.com/plus/v1/people/me" );
    ...
    }

    becomes :

    $response = $this->api->api( "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses" );
    
    if ( ! isset( $response->resourceName) || isset( $response->error ) ){
    	throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
    }
    
    $this->user->profile->identifier    = (property_exists($response,'resourceName'))?$response->resourceName:((property_exists($response,'resourceName'))?$response->resourceName:"");
    
    $this->user->profile->firstName     = "";
    $this->user->profile->lastName      = "";
    $this->user->profile->displayName   = "";
    
    if (property_exists($response, 'names')) {
    	if (is_array($response->names) && count($response->names) > 0) {
    		$this->user->profile->firstName = isset($response->names[0]->givenName)?$response->names[0]->givenName:"";
    		$this->user->profile->lastName = isset($response->names[0]->familyName)?$response->names[0]->familyName:"";
    		$this->user->profile->displayName = isset($response->names[0]->displayName)?$response->names[0]->displayName:"";
    	}
    }
    
    $this->user->profile->email         = "";
    
    if (property_exists($response, 'emailAddresses')) {
    	if (is_array($response->emailAddresses) && count($response->emailAddresses) > 0) {
    		$this->user->profile->email = isset($response->emailAddresses[0]->value)?$response->emailAddresses[0]->value:"";
    	}
    }
    
    $this->user->profile->photoURL      = (property_exists($response,'image'))?((property_exists($response->image,'url'))?substr($response->image->url, 0, -2)."200":''):'';
    $this->user->profile->profileURL    = (property_exists($response,'url'))?$response->url:"";
    $this->user->profile->description   = (property_exists($response,'aboutMe'))?$response->aboutMe:"";
    $this->user->profile->gender        = (property_exists($response,'gender'))?$response->gender:""; 
    $this->user->profile->language      = (property_exists($response,'locale'))?$response->locale:'';

    And last important thing, to migrate old identifiers, I need to update existing entries in the database (change WPCUSTOMPREFIX to match your database) :
    update WPCUSTOMPREFIX_wslusersprofiles set identifier = concat('people/',identifier) where provider = 'Google' and identifier not like 'people/%';

    I knows it’s not the most elegant PHP code possible… but it seems to work.
    As I am not sure that it doesn’t break something elsewhere, I suggest you to try in a dev environment…
    Such modifications would be overriden if the plugin should be updated but it seems that it is no longer maintained.

    So, unfortunately, my problem is different.
    It happens only when the usermeta table (almost 600 000 records) is included in the backup.
    Do you have an idea of what can cause the problem ?

    Thanks

    Hi,

    I have exactly the same problem.
    Before June 30, it was running fine.
    And from June 30, it does not work anymore with multiple “Job restarts due to inactivity for more than 5 minutes” in the log files.
    I tried to set max execution time to 25 but it did not solve the problem.

    Thanks for your help.

    Thread Starter Papoum

    (@papoum)

    Thank you, I will do that.

    Thread Starter Papoum

    (@papoum)

    Hi,

    The problem (not exactly the same problem but the same result) is back…
    When a scheduled post is published, po_plugins table is not updated.
    It seems that it is because of the adding of “is_admin()” condition in plugin-organizer.php (condition added in version 8.0).
    Is there a way to fix/hack this problem ?

    Thanks.

    Thread Starter Papoum

    (@papoum)

    Problem solved !
    Thank you.

    Thread Starter Papoum

    (@papoum)

    Great !

    Thanks.

    Thread Starter Papoum

    (@papoum)

    Thank you for your response and for your great plugin.
    I will wait for that feature.

    Hi,

    When using HTML (images) in answers fields, it seems that they are escaped when displayed in %QUESTIONS_ANSWERS% (%USER_ANSWER% and %CORRECT_ANSWER%).

    Is there a way to display HTML content in %USER_ANSWER% and %CORRECT_ANSWER% ?

    Thanks,
    Philippe

    Papoum

    (@papoum)

    I found a way to ignore gclid parameter (Adwords automatic tracking) by addind the following lines in the wp-cache-config.php (in the wp-content folder) :

    $param = "gclid";
    unset($_GET[$param]);
    list($urlRoot, $params) = array_pad(explode('?', $_SERVER[ 'REQUEST_URI' ]), 2, '');
    if (!empty($params)) {
    	parse_str($params, $vars);
    	unset($vars[$param]);
    	if (count($vars) > 0) {
    		$newParams = http_build_query($vars);
    		$_SERVER[ 'REQUEST_URI' ] = $urlRoot . '?' . $newParams;
    	}
    	else {
    		$_SERVER[ 'REQUEST_URI' ] = $urlRoot;
    	}
    }

    There are probably better ways to do that but it seems to work.
    Now cached pages are served to Adwords visitors.

    As I want to ignore also parameters used by Google Analytics Experiments, I apply the same method for “utm_expid” and “utm_referrer”.

    Papoum

    (@papoum)

    Hi,

    I have the same problem.
    Have you found a solution to ignore gclid parameter and make Adwords visitors see cached pages ?

    Thanks.

    Thread Starter Papoum

    (@papoum)

    Thank you for your response.

    I downgraded to the 3.0.4 version and it worked.
    For now, I do not have time to try the development version but I will try as soon as I can.

Viewing 14 replies - 1 through 14 (of 14 total)