Skip to content

Instantly share code, notes, and snippets.

@codehooligans
Last active August 29, 2015 14:16
Show Gist options
  • Save codehooligans/705e22f087c3c7d2ce5a to your computer and use it in GitHub Desktop.
Save codehooligans/705e22f087c3c7d2ce5a to your computer and use it in GitHub Desktop.
LoginRadius Plugin bug.
// 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