Page 1 of 1

SelfRegistration: Error message "Unknown column 'Array' in 'field list'"

Posted: Sun Dec 20, 2009 5:01 pm
by dipper88
Hi,

actually it's a very strange error-message I'm receiving when adding a new user via SelfRegistration to my DB.
I got several input fields, two dropdown menus and a multi select list. The only thing producing the error is the multi select list.

As soon as I select any value inside this list and hit the 'submit' button i get prompted the following error
"Unknown column 'Array' in 'field list'"

Afterwards I'm no longer able to add this user again, because he's already waiting for verification, but: no data entered in the form is submitted to the database, only the username is submitted and a user with no data is inserted.

But, if I don't make any selection inside the list everything works out fine and my user is dumped to DB and the mails is being sent.
I can verify the new user and afterwards make a selection from the list and submit it, this works out all right.


Anybody might have a solution for this error? I'd really appreciate it ;)

Re: SelfRegistration: Error message "Unknown column 'Array' in 'field list'"

Posted: Tue Jan 05, 2010 8:06 pm
by scooper
No solution just the same problem here as well I'm afraid.

If I checkout the latest version of the SelfRegistration module from SVN we now get an error message

Code: Select all

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/public_html/lib/classes/module_support/modform.inc.php on line 360
But still the same problem - adding a multi-select list breaks the registration.

Re: SelfRegistration: Error message "Unknown column 'Array' in 'field list'"

Posted: Tue Jan 05, 2010 8:45 pm
by jmcgin51
please provide version information (CMSMS and SelfReg/FEU)

If you're running the current versions, please submit an official bug report.  Reports here in the forum get quickly lost...

Re: SelfRegistration: Error message "Unknown column 'Array' in 'field list'"

Posted: Wed Jan 06, 2010 11:56 am
by scooper
Can repeat it consistently using a fresh install using latest versions of CMSMS, FEU and Selfreg and nothing else:

CMS Version 1.6.6
FrontEndUsers  1.6.11
SelfRegistration 1.2.5

Got it on a couple of different machines as well.

I will log it as a bug in the forge - but just in case anyone has any clues....

Re: SelfRegistration: Error message "Unknown column 'Array' in 'field list'"

Posted: Wed Jan 06, 2010 4:16 pm
by scooper
Getting closer anyway. I've got a bit of a workaround:

In SelfRegistration.module.php theres an api function

function AddTempUserProperty( $uid, $propname, $propvalue )

which stores the form options in the db. This is called from action.reguser.php when signing up (and probably when editing the user in the Self Reg admin).

If $propvalue is an Array() then we get a db error

Code: Select all

(mysql): INSERT INTO cms_module_selfreg_properties
          VALUES (10,9,'multiselect',Array)<br>
 Error (1054): Unknown column 'Array' in 'field list'<br>
(yay for turning on debug...).

And of course it is if we've used a multiselect field.

So - one way to stop this happening is to implode $propvalue if it is an array, so change

Code: Select all

 function AddTempUserProperty( $uid, $propname, $propvalue )
  {
	$db = $this->GetDb();
...
at around line 1107 of SelfRegistration.module.php to

Code: Select all

function AddTempUserProperty( $uid, $propname, $propvalue )
  {
   	//implode array to string
	if(is_array($propvalue)){
		$propvalue=implode(",", $propvalue);		
	}

	$db = $this->GetDb();
...
This seems to do the trick and keeps the values correctly through the sign up process and into FEU.
Whether or not this is the right place to do this I'll leave to Calyguy to decide once I've updated the bug tracker.
But if you need this to work quickly then it seems to do the trick.

s.

(blimey - it is really snowing here - well an awful lot more than it normally does in southern England).

Re: SelfRegistration: Error message "Unknown column 'Array' in 'field list'"

Posted: Thu Jan 28, 2010 5:32 pm
by dipper88
scooper wrote: So - one way to stop this happening is to implode $propvalue if it is an array, so change

Code: Select all

 function AddTempUserProperty( $uid, $propname, $propvalue )
  {
	$db = $this->GetDb();
...
at around line 1107 of SelfRegistration.module.php to

Code: Select all

function AddTempUserProperty( $uid, $propname, $propvalue )
  {
   	//implode array to string
	if(is_array($propvalue)){
		$propvalue=implode(",", $propvalue);		
	}

	$db = $this->GetDb();
...
Cool, thanks a lot!

This works fine for me so far.