I've set up a content type, "event", which can be posted by any user, but will be unpublished to begin with, then moderated by a user with the appropriate access.

When a logged-in user creates a node of this content type, it works correctly, and can be viewed, unpublished, deleted, etc.

However, when an anonymous user creates a node, it seems to go into the ether. The node appears correctly in the node database table, node_revisions, and a path alias is created in the url_alias table. But if I try accessing the node, either by typing in node/ or the path alias, I get a page not found error.

Then, I created a view to display the nodes, and the view shows them fine... But I still can't access the nodes directly. Anyone know what could be the problem?

Comments

geerlingguy’s picture

Interestingly, if I change the uid on the node (in the database) to any user other than 'anonymous' / '0', the node displays correctly. I have never seen behavior like this before!

__________________
Personal site: www.jeffgeerling.com

geerlingguy’s picture

It looks like, somehow, my user 0 (anonymous) was removed from the users table. I added him back in, and all is well.

Reference:
http://drupal.org/node/501286

I'm guessing this had to do with upgrading from 4.7.6-->4.7.11-->5.1-->5.16-->6.1-->6.13-->6.15

__________________
Personal site: www.jeffgeerling.com

michael_lessard_micles.biz’s picture

Just to be more specific for newer Drupal users :

If only anonymous cannot post, this means that in the table called users, you are missing a row with UID 0 (you will see UID 1 and more, but check if there is a UID 0).

Do not get confused with tables : role, users_roles, etc.

HOW TO :

Of course, open your database manager (phpMyAdmin for exemple)

i) check if there is a 0 in the UID column in table users

ii) if not, check if any row so happens to have no name at all: if so, that is your former UID 0 that has somehow changed to another UID. Just change it manually back to 0.

iii) if there both no UID 0 and no nameless row exist, create a brand new one, in which all columns are empty or NULL (will be selected by default when applies) except UID set to 0 manually.

--

For exemple, I had copied a database for a multisite (i.e. using the same core Drupal, you create many sites using different domain names; quite nifty). In my database transfer, for some reason my UID 0 (anonymous users) somehow was transformed in a new UID. So anonymous could never post anything successfully.

Michael Lessard
webmaster of Quebec City "democracy in action" media