Firdavs Khaydarov Posted February 17, 2016 Share Posted February 17, 2016 Link to comment Share on other sites More sharing options...
newbie LAC Posted February 17, 2016 Share Posted February 17, 2016 /* Try to find member */ $member = \IPS\Member::load( $userData['id'], 'my_custom_id' ); You can't use my_custom_id here Your error system/Patterns/ActiveRecord.php /* If we did, check it's valid */ elseif( !in_array( $idField, static::$databaseIdFields ) ) { throw new \InvalidArgumentException; } system/Member/Member.php /** * @brief [ActiveRecord] Database ID Fields */ protected static $databaseIdFields = array( 'name', 'email', 'fb_uid', 'live_id', 'google_id', 'linkedin_id', 'ipsconnect_id', 'twitter_id' ); Link to comment Share on other sites More sharing options...
Firdavs Khaydarov Posted February 18, 2016 Author Share Posted February 18, 2016 Should I expand the array $databaseIdFields? Link to comment Share on other sites More sharing options...
newbie LAC Posted February 18, 2016 Share Posted February 18, 2016 Add your key in array extended \IPS\Member class or use another way to find member Example try { $member = \IPS\Member::constructFromData( \IPS\Db::i()->select( '*', 'core_members', array( 'my_custom_id=?', $userData['id'] ) )->first() ); } catch (\Exception $e) { } Link to comment Share on other sites More sharing options...
Daniel F Posted February 18, 2016 Share Posted February 18, 2016 Yes Link to comment Share on other sites More sharing options...
Firdavs Khaydarov Posted February 18, 2016 Author Share Posted February 18, 2016 I can't expand the array, different ways I tried still goes error( Link to comment Share on other sites More sharing options...
Daniel F Posted February 18, 2016 Share Posted February 18, 2016 What did you try? One way would be to override setDefaultValues to add your custom key Link to comment Share on other sites More sharing options...
Firdavs Khaydarov Posted February 18, 2016 Author Share Posted February 18, 2016 22 minutes ago, Daniel F said: What did you try? One way would be to override setDefaultValues to add your custom key Thanks, problem solved. Link to comment Share on other sites More sharing options...
Daniel F Posted February 18, 2016 Share Posted February 18, 2016 If anybody else is interested into this: public function setDefaultValues() { parent::setDefaultValues(); static::$databaseIdFields[] = 'your_new_id_field'; } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.