User login

Drupal deleting User UID 0

Possible culprits:

./profiles/scf/modules/modified/user_import/user_import.module:1450: user_delete($existing, $existing->uid);
./profiles/scf/modules/modified/invite/invite_cancel_account.module:20: user_delete(array(), $account->uid);
./profiles/scf/modules/contrib/logintoboggan/logintoboggan.module:42: user_delete(array(), $account->uid);
./profiles/scf/modules/contrib/og/includes/ 'og_user_delete' => array(
./profiles/scf/modules/contrib/views_bulk_operations/ user_delete(null, $user->uid);

invite cancel account and logintoboggan are not enabled, and will be presumed innocent. I also like views_bulk_operations. Looking at user_import...

The fix for the symptom, not the cause:

INSERT INTO users SET uid = 0, name = 'anonymous'; INSERT INTO users_roles VALUES(0,1); DELETE FROM cache;

Update: Culprit turned out to be our database merging.


Searched words: 
user ID zero getting around autoincrement reinsert user zero drupal user zero deleted uid0 userid 0


How can i change my anonymous user id from zero

How can i change my anonymous user id from zero to any other user id say the admin user id?I added few pages in my site using an user id 12 but now i have deleted that id ,hence all pages which were added by user id 12 are tagged to user id 0 and cant be used by any other user.

Go directly into the database

Untested SQL statement:

UPDATE node SET uid=1 WHERE uid=0;


thanks Benjamin but ya i did that , dnt we have a permanent solution to it?

There must be a proper way in

There must be a proper way in Drupal to transfer ownership of some pages from one user to another before a user id gets deleted? If not, can we disable a user but not delete? And will the pages still work with a disabled user id?

custom module or simply 'block' user (like disabling)

It seems you may need to make a module to do this-- acting on hook_user with the delete op (hook_user_delete in Drupal 7) to assign content to an existing user.

Note you can simply block a user, rather than delete one, which is effectively your disabled user request.

Your solve doesn't work for

Your solve doesn't work for me, I added the rows but the anonymous user is still not with us, and my $_SESSION variable is still crashed for anonymous. Do you get an idea for the culprit?

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.