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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

evgeniysolodkov’s picture

FileSize
437 bytes

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

amitaibu’s picture

Status: Active » Needs review

Status: Needs review » Needs work

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

amitaibu’s picture

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

evgeniysolodkov’s picture

Status: Needs work » Needs review
FileSize
508 bytes

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

qpro’s picture

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).

mpotter’s picture

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.

mpotter’s picture

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.

MXT’s picture

I have the same issue: any news on this?

Thank you very much

amitaibu’s picture

@MXT , are you using latest dev?

MXT’s picture

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.

MXT’s picture

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

amitaibu’s picture

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

MXT’s picture

FileSize
350.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

amitaibu’s picture

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

amitaibu’s picture

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

Ok, I see - in user register. Changed title

amitaibu’s picture

Status: Needs work » Needs review
FileSize
636 bytes
amitaibu’s picture

Status: Needs review » Fixed

Committed.

MXT’s picture

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.