SOLVED: Adding fields to register module

mayanc1981

Joined: 2009-03-04
Posts: 6
Posted: Wed, 2009-03-04 12:16

Hello all,

I'm new to gallery and I'm trying to add new fields to the registration module.
I added the needed fields to the template, db and classes.

Everything works fine and shows in my registration form, but when I'm trying to activate the account,
I'm getting a php error which says that I'm using undefined method.

I defined the method in GalleryPendingUser.class as follows:

Quote:
/**
* The User's gender
*
* @g2 <member>
* @g2 <member-name>gender</member-name>
* @g2 <member-type>STRING</member-type>
* @g2 <member-size>MEDIUM</member-size>
* @g2 <member-external-access>FULL</member-external-access>
* @g2 </member>
*
* @var string $gender
* @access public
*/
var $gender;
/**
* The User's birthdate
*
* @g2 <member>
* @g2 <member-name>birthdate</member-name>
* @g2 <member-type>STRING</member-type>
* @g2 <member-size>MEDIUM</member-size>
* @g2 <member-external-access>FULL</member-external-access>
* @g2 </member>
*
* @var string $birthdate
* @access public
*/
var $birthdate;

Quote:
function getGender() {
return $this->gender;
}

function setGender($gender) {
$this->gender = $gender;
}

function setBirthdate($birthdate) {
$this->birthdate = $birthdate;
}

function getBirthdate() {
return $this->birthdate;
}

The line that throws that error is in GalleryPendingUserHelper.class:

Quote:
/* Copy all values to the new "real" user */
$user->setEmail($pendingUser->getEmail());
$user->setFullName($pendingUser->getFullName());
$user->setGender($pendingUser->getGender()); // This is the first line that throws the error
$user->setBirthdate($pendingUser->getBirthdate());
$user->setLanguage($pendingUser->getLanguage());
$user->setHashedPassword($pendingUser->getHashedPassword());

The user is being added to the pendingUsers table successfully, but when I'm trying to activate it I'm getting this error.

I reinstalled the registration plug in to make sure everything is compiled.

What am I missing?

Thanks in advance,
Mayan

p.s.
I tried using userdata module but it's not doing what I'm looking for.

 
mayanc1981

Joined: 2009-03-04
Posts: 6
Posted: Sun, 2009-03-08 09:02

I managed to solve this issue, but now the user is added successfully, but the additional fields don't get the new values in the users table (though I can see them in the pending users table...)

Any ideas?

 
mayanc1981

Joined: 2009-03-04
Posts: 6
Posted: Sun, 2009-03-08 21:31

I finally understood that if I add fields to an entity, I need to reinstall gallery to create all needed parts in db, etc.

Thanks anyway.

 
ASNet0007

Joined: 2006-10-17
Posts: 177
Posted: Mon, 2009-03-09 14:16
 
mayanc1981

Joined: 2009-03-04
Posts: 6
Posted: Mon, 2009-03-09 15:21

No, because as I understand it only allows to add fields in a separate page and not in the same registration page.

Mayan