8 – Force user to create a node after registration

Access to a Drupal site is provided by permissions, and permissions are assigned to Roles. So the first thing to do is to create two types of users – one which can access the site when logged on and one which can’t access the site when logged on. After that we can talk about how and when to change a specific user from the “can’t access” to the “can access” type.

A new user in Drupal is automatically assigned the “authenticated” role. Because you want new users by default to NOT have access to the site, you should edit the “authenticated” role to remove permissions. Test this to make sure that a new user has only the limited permissions you want them to have.

Now create a new role for your “full access” users. I will call that role “full access”. Edit the role to have the permissions you want. Test to make sure this is what you want.

Once you have the two roles setup, now is the time to figure out how to change a user from “authenticated” to “full access”. Because you tagged this issue as “rules” I assume you want to use Rules to do this. Rules provides a UI where you can do this without programming, and where you can easily modify your conditions for changing the user role or even take addition steps like sending the newly privileged user a welcome email, again without programming.

I’ll modify this answer to attach an actual Rule export when I have access to a computer, but for now here’s the outline of what the Rule should look like:

  • Event: After saving a new content item (This will happen when the user
    creates a new node. You may also restrict this event to fire only
    when content of a specific type is created.)

  • Condition: User has role(s)
    (Check to see if the user has the “full access” role yet.)

  • Action: Add user role
    (This will add the “full access” role to the user who just created a node and does not yet have full access.)

The remaining issue is how to inform the new user that they need to create a node in order to get full access. To do this you can use another Rule that looks like this:

  • Event: User has logged in

  • Condition: User has role(s)
    (Check to see if the user is “authenticated” – if so the user still needs to create a node.)

  • Action: Show a message on the site
    (If the condition is TRUE then we know the user needs to create a node, so use this message to inform them of what they need to do.)

  • Action: Page redirect
    (Redirect the user to the node create page, /node/add.)

Or if you have a custom page/form set up for the creation of this first node, then you can simply redirect to that page instead.