Page 1 of 1

getting more columns in com_user/user.php:userEdit();

Posted: Fri Nov 09, 2007 9:40 am
by Urme
I'm trying to edit the "Your details" page, I've added another column in jos_users table, which I named "address".

Now I'm trying to recieve the data in that column when a user is editing his details.

I'm 100% sure this is the function I need to change, if I add $row->address = "testtest"; after $row->username = trim( $row->username );, the address field will contain "testtest", but how can I recieve the data that's in the database column "address"?

Sorry if my english sucks ;) I've added the function userEdit below.

Code: Select all

function userEdit( $option, $uid, $submitvalue) {
   global $database, $mainframe;
   global $mosConfig_absolute_path;

   // security check to see if link exists in a menu
   $link = 'index.php?option=com_user&task=UserDetails';
   $query = "SELECT id"
   . "\n FROM #__menu"
   . "\n WHERE link LIKE '%$link%'"
   . "\n AND published = 1"
   ;
   $database->setQuery( $query );
   $exists = $database->loadResult();
   if ( !$exists ) {
      mosNotAuth();
      return;
   }

   require_once( $mosConfig_absolute_path .'/administrator/components/com_users/users.class.php' );

   if ($uid == 0) {
      mosNotAuth();
      return;
   }
   $row = new mosUser( $database );
   $row->load( (int)$uid );
   $row->orig_password = $row->password;

   $row->name = trim( $row->name );
   $row->email = trim( $row->email );
   $row->username = trim( $row->username );

   $file    = $mainframe->getPath( 'com_xml', 'com_users' );
   $params =& new mosUserParameters( $row->params, $file, 'component' );

   HTML_user::userEdit( $row, $option, $submitvalue, $params );
}

Re: getting more columns in com_user/user.php:userEdit();

Posted: Fri Nov 09, 2007 10:20 am
by Urme
I found the solution:

Added more variables in the function mosUser in joomla.php

Code: Select all

class mosUser extends mosDBTable {
   /** @var int Unique id*/
   var $id            = null;
   /** @var string The users real name (or nickname)*/
   var $name         = null;
   /** @var string The login name*/
   var $username      = null;
   /** @var string email*/
   var $email         = null;
   /** @var string MD5 encrypted password*/
   var $password      = null;
   /** @var string */
   var $usertype      = null;
   /** @var int */
   var $block         = null;
   /** @var int */
   var $sendEmail      = null;
   /** @var int The group id number */
   var $gid         = null;
   /** @var datetime */
   var $registerDate   = null;
   /** @var datetime */
   var $lastvisitDate   = null;
   /** @var string activation hash*/
   var $activation      = null;
   /** @var string */
   var $params         = null;
   /**ADDED MORE FIELDS**/
   /** @var string Address field*/
   var $address      = null;
   /** @var string Phone number*/
   var $phone      = null;
   /** @var string Mobile phone*/
   var $mobile      = null;
..
..
..
..