Menu

Adding more information for user profiles

Help
oz
2004-06-07
2004-06-08
  • oz

    oz - 2004-06-07

    I would like to add a business input field for users. I have tried by just adding this line.

    <td><b><?php echo _("Business") ?>:</b></td>
        <td><input type="text" name="PSA_business" size="20" value="<?php echo $user['business'] ?>"></td>
       </tr>

    I have also adding business to the table in the database... Is there a quick way to get this working? Thx

     
    • Justin Koivisto

      Justin Koivisto - 2004-06-07

      You'll also need to add the necessary code to the query in the class.phpSecurityAdm.php file for the addUser (line 1115) and editUser (line 997) methods.

       
    • oz

      oz - 2004-06-08

      Well I tried adding to.  1080-1099
      I get error.. Error posted @ the bottom.... Thanks

         if(!isset($ar['PSA_lname'])) $ar['PSA_lname']='';
              if(!isset($ar['PSA_fname'])) $ar['PSA_fname']='';
              if(!isset($ar['PSA_business'])) $ar['PSA_business']='';
              if(!isset($ar['PSA_mname'])) $ar['PSA_mname']='';
              if(!isset($ar['PSA_email'])) $ar['PSA_email']='';
              if(!isset($ar['PSA_phone'])) $ar['PSA_phone']='';
              if(!isset($ar['PSA_active'])) $ar['PSA_active']=0;

              $query.=', lname='.$this->db->GetTextFieldValue($ar['PSA_lname']).
                  ', business='.$this->db->GetTextFieldValue($ar['PSA_business']).
                  ', fname='.$this->db->GetTextFieldValue($ar['PSA_fname']).
                  ', mname='.$this->db->GetTextFieldValue($ar['PSA_mname']).
                  ', email='.$this->db->GetTextFieldValue($ar['PSA_email']).
                  ', phone='.$this->db->GetTextFieldValue($ar['PSA_phone']).
                  ', id='.$this->db->GetTextFieldValue($ar['PSA_id']).
                  ', pass='.$this->db->GetTextFieldValue($password).
                  ', hash='.$this->db->GetTextFieldValue($hash).
                  ', groups='.$this->db->GetTextFieldValue($groups).
                  ', active='.$this->db->GetBooleanFieldValue($ar['PSA_active']);
              $result=$this->db->Query($query);

      Warning: Bad column offset specified in /home/httpd/vhosts/somehost/httpdocs/admin/brokers/include/metabase/metabase_mysql.php on line 210
      User Updated Successfully.

      Warning: Bad column offset specified in /home/httpd/vhosts/somehost/httpdocs/admin/brokers/include/metabase/metabase_mysql.php on line 210

       
      • Justin Koivisto

        Justin Koivisto - 2004-06-08

        Sounds like a MetaBase error to me. However, this isn't an error, only a warning. Does the data go into the database?

        I've seen this error before (don't remember where), but to fix it I had to change something with my query syntax or the procedure I used to build the query.

         
    • oz

      oz - 2004-06-08

      Ok got it.... Thank you...

       
    • oz

      oz - 2004-06-08

      This is what my query looks like      

      $query='SELECT psa_users.id, psa_users.fname, psa_users.lname, psa_users.mname, psa_users.email, psa_users.groups, '.
                  'psa_users.phone, psa_users.connection, psa_users.active, psa_users.hash,  '.
                  'psa_users.business, psa_users.address, psa_users.address2, psa_users.city, psa_users.state, psa_users.tax, psa_users.website,'.
                  'psa_pass_recover.question, psa_pass_recover.answer, psa_pass_recover.confirm FROM psa_users, psa_pass_recover WHERE psa_users.hash = psa_pass_recover.id';
              $result=$this->db->Query($query);
              if(!$result){
                  $this->ERROR[]=$this->db->Error();
                  return FALSE;
              }

              for($i=0;$i<$this->db->NumberOfRows($result);++$i){
                  $id=$this->db->FetchResult($result,$i,0);
                  $fname=$this->db->FetchResult($result,$i,1);
                  $lname=$this->db->FetchResult($result,$i,2);
                  $mname=$this->db->FetchResult($result,$i,3);
                  $email=$this->db->FetchResult($result,$i,4);
                  $phone=$this->db->FetchResult($result,$i,6);
                  $groups_tmp=$this->db->FetchResult($result,$i,5);
                  $connection=$this->db->FetchResult($result,$i,7);
                  $active=$this->db->FetchBooleanResult($result,$i,8);
                  $hash=$this->db->FetchResult($result,$i,9);
                  $business=$this->db->FetchResult($result,$i,10);
                  $address=$this->db->FetchResult($result,$i,11);
                  $address2=$this->db->FetchResult($result,$i,12);
                  $city=$this->db->FetchResult($result,$i,13);
                  $state=$this->db->FetchResult($result,$i,14);
                  $zip=$this->db->FetchResult($result,$i,15);
                  $tax=$this->db->FetchResult($result,$i,16);
                  $website=$this->db->FetchResult($result,$i,17);
                  $question=$this->db->FetchResult($result,$i,18);
                  $answer=$this->db->FetchResult($result,$i,19);
                  $confirm=$this->db->FetchResult($result,$i,20);
                  $name=$lname.', '.$fname;
                  $tmp=explode(',',$groups_tmp);
                  $admin=0;
                  foreach($tmp as $gid){
                      if(isset($groups[$gid])){
                          $admin=1;
                          break;
                      }
                  }

                  $users[$id]=array('id'=>$id,
                                      'name'=>$name,
                                      'email'=>$email,
                                      'phone'=>$phone,
                                      'connection'=>$connection,
                                      'admin'=>$admin,
                                      'active'=>$active,
                                      'lname'=>$lname,
                                      'fname'=>$fname,
                                      'mname'=>$mname,
                                      'groups'=>implode(',',$tmp),
                                      'hash'=>$hash,
                                      'question'=>$question,
                                      'answer'=>$answer,
                                      'business'=>$business,
                                      'address'=>$address,
                                      'address2'=>$address2,
                                      'city'=>$city,
                                      'state'=>$state,
                                      'zip'=>$zip,
                                      'tax'=>$tax,
                                      'website'=>$website,
                                      'confirm'=>$confirm);
              }

       
    • oz

      oz - 2004-06-08

      they error was in the query portion of code. Missing field.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.