Showing group register field on registration page get this error:

Recoverable fatal error: Method DatabaseCondition::__toString() must return a string value en og_register_query_og_alter() (line 51 de /var/www/d7/sites/all/modules/og/og_register/og_register.module).

OG field settings:

  • Group - Node entity : Group & Group register
  • User - User entity : Groups audience

also showing groups audience field (account settings) in registration form

Files: 
CommentFileSizeAuthor
#17 1782768-og-register-query-fix-17.patch636 bytesAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 733 pass(es).
[ View ]
#14 og-error-sql.zip350.11 KBMXT
#5 og-condition_field_is_string-1782768-5.patch508 bytesevgeniysolodkov
PASSED: [[SimpleTest]]: [MySQL] 695 pass(es).
[ View ]
#1 og-1782768-1.patch437 bytesevgeniysolodkov
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch og-1782768-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

StatusFileSize
new437 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch og-1782768-1.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I had the same issue and wrote a little patch to solve it. You're welcome to try it.

Status:Active» Needs review

Status:Needs review» Needs work

The last submitted patch, og-1782768-1.patch, failed testing.

Can you re-roll patch, so it can be applied by testbot?

Status:Needs work» Needs review
StatusFileSize
new508 bytes
PASSED: [[SimpleTest]]: [MySQL] 695 pass(es).
[ View ]

Re-roll of #1... making my first patch, sorry if i'm doing something wrong ))

Status:Needs review» Needs work

I applied the patch to 7.x-2.0-beta2+32-dev version and now get this:

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] => 75 [:db_insert_placeholder_2] => 75 [:db_insert_placeholder_3] => example_user_register [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) en field_sql_storage_field_storage_write() (line 448 of /var/www/d7/modules/field/modules/field_sql_storage/field_sql_storage.module).

Priority:Normal» Major

Just patching it to skip if you can't convert to a string isn't the solution. If you actually dump the $query object (or the $condition object), you'll see that there is a recursive Condition element attached to the query somehow. We need to figure out where the botched query is getting created in the first place and fix it there. Still debugging this. Pretty much makes the og_register module useless right now, so also raising the importance.

Looks like this is a complex query where there is a nested "SELECT" statement within the Condition of the main query. It is happening for taxonomy entity types ($group_type = 'taxonomy_term') and the nested Select looks like some complex access check. Not sure why it's even calling this with taxonomy_term.tid. At one point I tried to set up a taxonomy as a group, but I deleted that. But maybe there is something still stuck in one of the database tables that would make this harder to reproduce.

Thing is, even if I "return" from this alter function if $entity_type != 'node' I still don't see a list of my group on the new user register page.

I have the same issue: any news on this?

Thank you very much

@MXT , are you using latest dev?

Hi Amitaibu, I'm using 7.x-2.0-beta4 (dec 13).

Let me upgrade to latest dev (dec 18), then I'll come here to refer.

Yes, I can confirm that the error persist also with latest dev (dec 18):

Recoverable fatal error: Method DatabaseCondition::__toString() must return a string value in og_register_query_og_alter() (line 51 of /var/www/mysite/sites/all/modules/contrib/og/og_register/og_register.module).

Some info:

  1. The error occurs when field og_user_group_ref in user profile settings is setted to "show in user registration form" (/admin/config/people/accounts/fields)
  2. Cardinality for og_user_group_ref is set to 1.

Thank you for paying attention to this issue

Can you attach a db dump, with all unrelated modules disabled?

StatusFileSize
new350.11 KB

Here in attachment a fresh installation with only OG module (and related) installed.

With this attached DB you can verify by yourself:

  1. the issue described in this thread
  2. the issue described here: http://drupal.org/node/1818390#comment-6815220

Superuser credentials:

  • user: admin
  • password: password

Installed modules:

  • admin_menu
  • ctools
  • devel
  • entity (latest DEV version)
  • entityreference (latest DEV version)
  • og (latest DEV version)
  • views
  • views_bulk_operations

Thank you very much for working on this

@MXT,
In what link do you see the error?

Title:Recoverable fatal error: Method DatabaseCondition::__toString() must return a string value en og_register_query_og_alterRecoverable fatal error: in og_register_query_og_alter, no user register

Ok, I see - in user register. Changed title

Status:Needs work» Needs review
StatusFileSize
new636 bytes
PASSED: [[SimpleTest]]: [MySQL] 733 pass(es).
[ View ]

Status:Needs review» Fixed

Committed.

Thank you very much for resolving the issue Amitabu, now the error disappears, but now there is another issue:

If a user choose a group on the website registration form then, after form submission, user is immediately added to that group even if that group needs a membership approval.

User state is automatically set to "active" instead of "pending" bypassing the subscription request and approval from group administrator (obviously if the permission "Subscribe to group" setting for that group is setted to
"Allow non-members to request membership to a group (approval required)".

I'll open another issue for this.

EDIT: here's the link: http://drupal.org/node/1873194

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.