Last active
August 29, 2015 14:16
-
-
Save codehooligans/705e22f087c3c7d2ce5a to your computer and use it in GitHub Desktop.
LoginRadius Plugin bug.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In the file LoginRadius.php in the function login_radius_update_profile_data | |
// The following logic starts at line 712 | |
$contacts = $loginRadiusObject->loginradius_get_contacts( self::$loginRadiusAccessToken ); | |
if ( is_array( $contacts ) && count( $contacts ) > 0 ) { | |
$wpdb->delete( $wpdb->base_prefix . 'loginradius_contacts', array( 'user_id' => $userId ) ); | |
foreach ( $contacts as $contact ) { | |
// The issue is the compare of the $contacts object. In the IF above the $contacts is | |
// checked to see if it is an array. The problem is $contacts is actuall an object. | |
// as part of the object there is an element $contacts->Data which is an array | |
// or contacts. | |
// $contacts looks like this | |
contactsstdClass Object | |
( | |
[Data] => Array | |
( | |
[0] => stdClass Object | |
( | |
[Name] => private private | |
[EmailID] => | |
[PhoneNumber] => | |
[ID] => private | |
[ProfileUrl] => | |
[ImageUrl] => | |
[Status] => | |
[Industry] => | |
[Country] => | |
[Location] => | |
[Gender] => | |
[DateOfBirth] => | |
) | |
// So the FIX would be to compare on the actual array $contacts->Data as in | |
$contacts = $loginRadiusObject->loginradius_get_contacts( self::$loginRadiusAccessToken ); | |
if ( is_array( $contacts->Data ) && count( $contacts->Data ) > 0 ) { | |
$wpdb->delete( $wpdb->base_prefix . 'loginradius_contacts', array( 'user_id' => $userId ) ); | |
foreach ( $contacts->Data as $contact ) { | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment