Getting error PDOException when trying to create new user at user/register. Admin can add users at admin/people/create.

Using Logintoboggan module, Added and removed a number of fields from user account, included then removed "use profile2 on registration".

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_published_value' at row 1: INSERT INTO {field_data_field_published} (entity_type, entity_id, revision_id, bundle, delta, language, field_published_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => message [:db_insert_placeholder_1] => 1167 [:db_insert_placeholder_2] => 1167 [:db_insert_placeholder_3] => example_user_register [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 448 of /home1/reallig1/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

Comments

Also enabled then disabled:

PERSONALIZATION
Enable signatures.
Enable user pictures.
Enable pictures on registration

Project:Drupal core» Message
Version:7.15» 7.x-1.x-dev
Component:mysql database» Code

I believe that this error should be lodged against the module that provides the "message" entity type. My best guess is the message module, but switch queues if I'm mistaken.

Let the maintainer know what integration this has with the user profile and also if you have Rules firing off actions during registration

Thanks. There was one Rule to redirect on login to user/ but I deleted the rule earlier as part of my troubleshooting.

Version:7.x-1.x-dev» 7.x-1.5

Updated Message module version installed.

Removed Message Module and can now register as a new user at user/register.

Installed 7x-1.x-dev and received following WSOD level error after attempting to clear cache & run cron:

Warning: array_keys() [function.array-keys]: The first argument should be an array in drupal_schema_fields_sql() (line 6899 of /home1/reallig1/public_html/includes/common.inc).
Warning: array_keys() [function.array-keys]: The first argument should be an array in drupal_schema_fields_sql() (line 6899 of /home1/reallig1/public_html/includes/common.inc).
Warning: array_keys() [function.array-keys]: The first argument should be an array in drupal_schema_fields_sql() (line 6899 of /home1/reallig1/public_html/includes/common.inc).
Recoverable fatal error: Argument 2 passed to SelectQuery::fields() must be an array, null given, called in /home1/reallig1/public_html/includes/entity.inc on line 284 and defined in SelectQuery->fields() (line 1300 of /home1/reallig1/public_html/includes/database/select.inc).

Removing Message module results in recovery of site and normal operations.

Status:Active» Postponed (maintainer needs more info)
Issue tags:-field_sql_storage

I'll need more info. Can you reproduce on a clean installation?

+1 I also have the issue. With Message module installed, I tried to use Services api to register an user. Got the error.

After I disabled Message module, register an user via Services works.

I'm receiving the same error with the Message module enabled.

Version:7.x-1.5» 7.x-1.7

Recently installed Message on site for first time. Used 7.x-1.7. Immediately encountered this error. Came here, read thread, disabled module. Error went away, new users successfully register on site. Here is my error message:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_published_value' at row 1: INSERT INTO {field_data_field_published} (entity_type, entity_id, revision_id, bundle, delta, language, field_published_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => message [:db_insert_placeholder_1] => 8 [:db_insert_placeholder_2] => 8 [:db_insert_placeholder_3] => example_user_register [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 448 of C:\Users\Mskil\Sites\dev01\modules\field\modules\field_sql_storage\field_sql_storage.module).

Maybe you have message-example installed, but didn't clear-cache?

It appears that if "Who can register accounts?" under Account Settings is set to "Visitors, but administrator approval is required" then $account->status returns null rather than 0.

If set to visitors $account->status correctly returns 1.

Adding this modification to message_example_user_insert() in message_example.module seems to fix:

<?php
/**
* Implements hook_user_insert()
*/
function message_example_user_insert(&$edit, $account, $category) {
 
$message = message_create('example_user_register', array(), $account);
 
$wrapper = entity_metadata_wrapper('message', $message);
+  if (
$account->status) {
   
$wrapper->field_published->set($account->status);
+  } else {
$wrapper ->field_published->set('0');
+ }
 
$wrapper->save();
}
?>

Status:Postponed (maintainer needs more info)» Active

Ok, how about writing a proper patch ? :)

btw, you should probably disable message_example in production -- it's just an example module.

Patch it is then. ;)

Looks like we can simply test that there is a status and if not use the unpublished default simplifying the patch a bit.

Status:Active» Needs work

+++ b/message_example/message_example.moduleundefined
@@ -58,7 +58,11 @@ function message_example_comment_insert($comment) {
+  // integer is returned

instead of "integer", maybe better write "status" property doesn't exist.

+++ b/message_example/message_example.moduleundefined
@@ -58,7 +58,11 @@ function message_example_comment_insert($comment) {
+  if ($account->status) {

Use !empty()

Amitaibu, I really appreciate you taking the time to guide me through what I am sure you could much more quickly just do on your own. Thanks for guiding me down the road toward providing patches, your patience and mentorship are emblematic of why I've fallen in love with Drupal and the Drupal Community. And thanks for all your contributions, I build web using your modules every day!

Here's a different version of patch 16 that also changes the published field for user registration messages on hook_user_update().

Use cases would involve installations where the account setting is "Visitors, but administrator approval required" and an administrator approves a new registration or a user is blocked.

I bundled the update logic inside hook_user_update() rather than cruft up message_example_update_message_status(). Not certain if this was the right decision. Or for that matter I'm not certain if this should be a separate issue ;)

There may be some unnecessary recursion in here. I wasn't sure what cardinality was possible given the complexity of different Drupal installations.

> I really appreciate you taking the time to guide me through what I am sure you could much more quickly just do on your own.

Sure, as long you provide the patches/ docs I'll do what I can :)

I prefer not to deal with #17 -- remember, this is just an example module, so I don't care about all the use cases. So review for #16. Minor issues:

+++ b/message_example/message_example.moduleundefined
@@ -58,7 +58,11 @@ function message_example_comment_insert($comment) {
+  // If account setting is "Visitors, but administrator approval required" ¶

You have trailing space.

+++ b/message_example/message_example.moduleundefined
@@ -58,7 +58,11 @@ function message_example_comment_insert($comment) {
+  // status property doesn't exist

Missing dot in end of line.

Title:SQL Error when trying to create new user at user/registerError when trying to create new user at user/register when user approval is required

Better title

Better late than never?! (#16 corrected)

Cannot create New User Account

Initially I got this error: EntityMetadataWrapperException: Unknown data property field_published. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/mysite/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).

I don't have access to GIT and I have exhausted trying to use the Drupal Patch module: http://drupal.org/files/message-error-when-trying-to-create-new-user-180.... Ran the Patch and

Got this error: EntityMetadataWrapperException: Unknown data property field_node_ref. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/mysite/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).

I have even tried to put the patch into the message_example directory. Nothing.

Any suggestions?

It would be best to use git, but it isn't necessary. Just encouraged. ;)

You can use git on your local machine and then copy the files up to the server. There are git clients for every OS. Here's a basic overview of how to patch with a good video that helped me.

A patch file is a set of instructions to edit other files. This particular patch is editing four lines in message_example.module (most likely located at /sites/all/modules/message/message_example/message_example.module in your installation).

If you open message-error-when-trying-to-create-new-user-1807532-20.patch you'll see it pretty readable.

Until you become familiar with git you can simply open a text editor and add the lines prefaced with a + (plus) and delete those with a - (minus). This method may kill kittens, but it works and it will familiarize you with git syntax and drupal coding. At least that's how I started. ;)

In the case of this patch though, that isn't even necessary. If you go to http://{yoursite}/admin/config/people/accounts and set "Who can register accounts?" to anything but "Visitors, but administrator approval is required" you won't see this error.

Also, as Amitaibu advised above... you don't want to be running an example module in production, so changing this setting shouldn't be an issue in testing/development.

Priority:Normal» Critical

A hopeful as I was that this was the solution and after trying every combination of "Who can register" they all returned the same exact error.

EntityMetadataWrapperException: Unknown data property field_published. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/mysite/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).

Then, I manually tried to patch the file and the following:

Thank you for applying for an account. Your account is currently pending approval by the site administrator.
Once it has been approved, you will receive an e-mail containing further instructions.

Thank you very much!!!

It's not critical if it's in the example module..

Title:Error when trying to create new user at user/register when user approval is requiredError when trying to create new user at user/register
Version:7.x-1.7» 7.x-1.x-dev
Priority:Critical» Normal

Changing title to reflect current understanding. I enabled all message modules today (including example) and immediately reproduced the error.

I updated to the latest dev version, same error.

My site no longer requires approval of new members.