[TYPO3] sr_feuser_register: trying to have 2 edit screens (SOLVED)

Francois Suter fsuter at cobweb.ch
Sat Nov 3 20:59:17 CET 2007


Hi again,

For those interested in following up on this issue, I stumbled onto  
yet another problem: when the data from the second form was  
submitted, the password field was emptied. I haven't looked into the  
details of the database updating process, but somehow the password  
was saved even though it was empty (since it wasn't in the form).

Looking around I found the method that performs the writing of the  
data: it's tx_srfeuserregister_data::save(). Apparently the problem  
of fields being overwritten by empty values is a known one, since  
there's the following code in that method:

					// Do not reset the name if we have no new value
				if (!in_array('name', t3lib_div::trimExplode(',', $this->conf 
[$cmdKey.'.']['fields'], 1)) && !in_array('first_name',  
t3lib_div::trimExplode(',', $this->conf[$cmdKey.'.']['fields'], 1))  
&& !in_array('last_name', t3lib_div::trimExplode(',', $this->conf 
[$cmdKey.'.']['fields'], 1))) {
					$newFieldList  = implode(',', array_diff(explode(',',  
$newFieldList), array('name')));
				}
					// Do not reset the username if we have no new value
				if (!in_array('username', t3lib_div::trimExplode(',', $this->conf 
[$cmdKey.'.']['fields'], 1)) ) {
					$newFieldList  = implode(',', array_diff(explode(',',  
$newFieldList), array('username')));
				}

I added a similar block of code for the password field and was able  
to save my form without loosing the current password:

					// Do not reset the password if we have no new value
				if (!in_array('password', t3lib_div::trimExplode(',', $this->conf 
[$cmdKey.'.']['fields'], 1)) ) {
					$newFieldList  = implode(',', array_diff(explode(',',  
$newFieldList), array('password')));
				}

I wonder why these fields need to be singled out. I hope we can have  
Franz's input on this.

Cheers

François Suter

-- 
Cobweb Development Sàrl
www.cobweb.ch

Rue Eugène-Marziano 15, CH-1227 Les Acacias (Geneva - Switzerland)
T: +41 22 880 00 93, F: +41 22 880 00 94, E: support at cobweb.ch
web solutions for professionnal requirements






More information about the TYPO3-english mailing list