CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • ERROR: 1054 Unknown Column drupal_users.uid
Pages: [1]

Author Topic: ERROR: 1054 Unknown Column drupal_users.uid  (Read 3871 times)

jeffmikels

  • I’m new here
  • *
  • Posts: 26
  • Karma: 0
ERROR: 1054 Unknown Column drupal_users.uid
June 01, 2011, 10:00:05 pm
DRUPAL VERSION: 7.2
CIVICRM VERSION: 4.0.1

I'm trying to create a website for an association of churches. I have designed the front-facing drupal site and have enabled CiviCRM to handle the constituent database and the registration of new members.

I have created profiles, memberships, and a front-facing registration page. However, when a new user (without a drupal login) tries to register on the membership registration page, I get the following error:

Code: [Select]
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'drupal_users.uid' in 'field list': SELECT drupal_users.uid AS uid FROM {users} users WHERE (name LIKE :db_condition_placeholder_0 ESCAPE '\\') LIMIT 1 OFFSET 0; Array ( [:db_condition_placeholder_0] => testerson ) in CRM_Core_BAO_CMSUser::checkUserNameEmailExists() (line 369 of /home/[full_path_details_removed]/sites/all/modules/civicrm/CRM/Core/BAO/CMSUser.php).
You may try to duplicate the problem by registering a fictional organization if you wish.

The front-facing site is http://teammglpw.org and the registration page is http://teammglpw.org/civicrm/contribute/transact?reset=1&id=1

Does anyone have any words of insight?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: ERROR: 1054 Unknown Column drupal_users.uid
June 02, 2011, 03:41:14 am
Go to civicrm/admin/setting/uf?reset=1 and make sure it says users there.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

jeffmikels

  • I’m new here
  • *
  • Posts: 26
  • Karma: 0
Re: ERROR: 1054 Unknown Column drupal_users.uid
June 06, 2011, 10:14:18 am
That setting is currently set to drupal_users because I'm using drupal_ as the table prefix. Are you suggesting that I need to make that "users" even though I'm using a table prefix?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: ERROR: 1054 Unknown Column drupal_users.uid
June 06, 2011, 10:17:56 am
No, my mistake. I looked again at your error. Actually looks like a bug to me but one of the developers will have to confirm that.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: ERROR: 1054 Unknown Column drupal_users.uid
August 08, 2011, 01:27:02 pm
Hey Jeff

Did you find a solution to this?
I'm getting the same error :/

Best regards
/Anders:)

lucido

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.4
  • MySQL version: 5.1
  • PHP version: 5.3
Re: ERROR: 1054 Unknown Column drupal_users.uid
August 19, 2011, 02:50:12 pm
Hi there

I face the same error message. The code that generates the query in the file CMSUser looks like this:

    db_select('users')->fields($config->userFrameworkUsersTableName, array('uid'))->condition('mail', db_like($params['mail']), 'LIKE')->range(0, 1)->execute()->fetchField()

The SQL output before replacing the table placeholder looks like this:

    SELECT dru_users.uid AS uid FROM {users} users WHERE  (name LIKE :db_condition_placeholder_0 ESCAPE '\\') LIMIT 1 OFFSET 0

where {users} will be replaced by dru_users (my db prefix is 'dru_'). But there is still the word 'users' after {users} which i think causes the error -> the SQL output after replacing the table placeholder looks like this:

    SELECT dru_users.uid AS uid FROM dru_users users WHERE  (name LIKE :db_condition_placeholder_0 ESCAPE '\\') LIMIT 1 OFFSET 0

Has anyone an idea why the tablename is beeing doubled? I've got some trouble to solve the problem...

Thanks in advance
Lucido

lucido

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.4
  • MySQL version: 5.1
  • PHP version: 5.3
Re: ERROR: 1054 Unknown Column drupal_users.uid
August 22, 2011, 02:12:25 am
The answer's written here:

bitnr[dot]drupalgardens[dot]com[slash]content[slash]wherein-i-develop-rote-understanding-drupal-7-database-api
(sorry for the inconvient way the link is posted. I'm not yet allowed to post external links...)

(Search for "PDOException" on this site)

Not the tablename ($config->userFrameworkUsersTableName, which is dru_users in the above case), but the alias of the table "users" which stands right after {users} (without the "AS" to stay compatible with other DB systems) has to be referenced within the fields() function.

Cheers
Lucido

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Re: ERROR: 1054 Unknown Column drupal_users.uid
October 18, 2011, 10:40:00 am
In my specific case I changed two lines in /sites/all/modules/civicrm/CRM/Core/BAO/CMSUser.php in the function checkUserNameEmailExists (around line 340 or so)

This line (in my case line 355):
Code: [Select]
} elseif ( (bool) db_select('users')->fields($config->userFrameworkUsersTableName, array('uid'))->condition('name', db_like($params['name']), 'LIKE')->range(0, 1)->execute()->fetchField() )  {
To this:
Code: [Select]
} elseif ( (bool) db_select('users')->fields('users', array('uid'))->condition('name', db_like($params['name']), 'LIKE')->range(0, 1)->execute()->fetchField() )  {
And also the one very similar to it 9 lines further down in the next if clause.

Thanks for your answers lucido !
Cheers :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • ERROR: 1054 Unknown Column drupal_users.uid

This forum was archived on 2017-11-26.