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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • [Drupal] "Could not find valid Key" > how to create 'uid = 0' ?
Pages: [1]

Author Topic: [Drupal] "Could not find valid Key" > how to create 'uid = 0' ?  (Read 2250 times)

Stijn

  • I’m new here
  • *
  • Posts: 11
  • Karma: 1
[Drupal] "Could not find valid Key" > how to create 'uid = 0' ?
November 06, 2009, 08:18:39 am
I'm getting the "Could not find valid Key" error message multiple times when using CiviCRM. Especially when searching or deleting users.

I followed the instructions in the "Installation and Configuration Trouble-shooting".

I'm having difficulties with:
"3. For Drupal sites, ensure that uid = 0 exists in your Drupal users table. This is required for anonymous access to CiviCRM pages and forms to work properly."

I've checked the Drupal table 'users' with phpMyAdmin, and there is no user with uid=0, so I tried to correct that. If I add a new user with the front-end then it creates a consecutive uid after the latest added user, so that doesn't help. Also, if I use phpMyAdmin to manually alter the uid of any user in the table to zero then the search functionality still doesn't work; I get the same error message. Furthermore I get a lot more error messages when I try to edit that specific user (the one I set to uid=0), so I had to set it back to it's original uid. This also happens to a user I've just added so apparently drupal/civicrm doesn't like me messing in it's tables directly.

Is there another way to create a user with uid=0? Otherwise I would know how to 'ensure' it.

Maybe I'm missing the point and is this whole uid=0 just one possible cause of the error message, and is my specific case due to something else (although I still don't have a user with uid=0). I wouldn't know; so if somebody can help me out I would be much obliged. Thanks for any effort.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: [Drupal] "Could not find valid Key" > how to create 'uid = 0' ?
November 06, 2009, 09:34:23 am

1. not having uid = 0 will cause session issues when anon users try to access profile / contribution / event registration pages

2. you can use PMA to insert a new record with uid = 0 in the users table

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Stijn

  • I’m new here
  • *
  • Posts: 11
  • Karma: 1
Re: [Drupal] "Could not find valid Key" > how to create 'uid = 0' ?
November 09, 2009, 12:03:56 am
Thanks! I had to truncate the sessions-table as well, and now this functions correctly.
« Last Edit: November 14, 2009, 05:10:59 am by Stijn »

LEYF

  • Guest
Re: [Drupal] "Could not find valid Key" > how to create 'uid = 0' ?
July 02, 2010, 10:37:11 am
I was having the "Could not find valid key" error problem when anonymous users tried to register for civicrm events and got the error after completing the first event registration form and clicking 'continue'.

Thank you lobo for posting a solution and Stijn for the tip to empty the Drupal sessions table.  The fact that anonymous users could not register for events was a real issue!

I'd note that in addition, I did need to make sure that the record I inserted into the Drupal users table had status '1', i.e. active, and had to insert a record into the users_roles table with uid=0 and rid=1 to grant the new 0 user the anonymous role.  Then it all worked.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • [Drupal] "Could not find valid Key" > how to create 'uid = 0' ?

This forum was archived on 2017-11-26.