Quantcast
Channel: Authentication
Viewing all articles
Browse latest Browse all 8284

Re: Username Change with External Database Authentication

$
0
0
by Lluís Forns Puigmartí.  

I was trying to change sync function to, prior to delete/disable a user, check if username was changed. But my function fails when trying to update username (database write error). Any hint?

                    //check if user changed username
                    $user_changed_name=FALSE;
                    if (!empty($user->idnumber)) {
                        $authdb = $this->db_init();
                        $sql="SELECT ".$this->config->field_map_idnumber." AS idnumber , ".$this->config->fielduser." AS username
                                                     FROM {$this->config->table}
                                                     WHERE ".$this->config->field_map_idnumber." = '".addslashes($user->idnumber)."'";
                        $rs = $authdb->GetRow($sql);
                        if ($rs) {
                            $updateuser = new stdClass();
                            $updateuser->id   = $user->id;
                            $updateuser->username = $rs['username'];
                         print_r($updateuser);
                            $authdb->update_record('user', $updateuser);
                            $user_changed_name = TRUE;
                          }
                          $authdb->Close();
                    }

 

I could post full file if needed

 


Viewing all articles
Browse latest Browse all 8284


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>