Restricting page views until the profile is complete

suganyaM's picture


When i looked for drupal 6.x version of Profile Enforcer module, i got the Content Profile module that cover the same functionality of Profile Enforcer module.

The main objective of Profile Enforcer module is to restrict the user from other page views until the profile is complete. How to achieve the same functionality using Content Profile module.? I have installed Content Profile module, added few fields to the Profile CCK type, given the permission for the fields. Have I missed out some settings? Its urgent pls.

Can any one help me in this regards?

Thanks in advance.


Probably the easiest way to

dmiric's picture

Probably the easiest way to do it is by using Rules module. You could simply set redirect to profile or anywhere else you want to if profile node does not exist.

Its also good because you can fine tune which pages you want to be visible and which ones you want to forbid.

Hope that helps

Thanks for your reply. I did

suganyaM's picture

Thanks for your reply. I did installed rules module as per your suggestion.

My requirement is to restrict user to view any pages, until he completes his profile. I have created the rules event and action. The action for the rule is to display a error message, 'You have not yet completed your profile. Please complete it before you proceed on'. But when the user browse any page, the user is left with a error message above the page content, and then the page content is displayed.

Is there any way to exit, that is the user should only be given the error message.

Thanks in advance.

I think you should be able to

dmiric's picture

I think you should be able to make a static page where user is redirected.

Thanks alot dmric. It worked

suganyaM's picture

Thanks alot dmric. It worked for me.

Hi suganyaM, I needed to do

luizcoura's picture

Hi suganyaM,

I needed to do the same thing that you and I created this rule:

ON EVENT Content is going to be viewed
NOT User has content profile
AND User has role (authenticated)
Page Redirect (node/add/profile)
Show a Message ("please complete your profile")

What rule did you use?

Luiz Coura

Hi Luiz Henrique Coura, More

suganyaM's picture

Hi Luiz Henrique Coura,
More or less I have done with the same concept.

  1. On an Event, a page/form is loaded
  2. Execute the following php code to check the profile category.
  3. If profile not completed,
    'page redirection' action to 'user/print $account->uid/edit' with message on top
    load the page/form

The php code is :

= 'Personal Info';
$fields = _profile_get_fields($category);
$user_array = (array)$account;
$errorFlag = false;
while (
$field = db_fetch_object($fields)) { 
$field->required && ($user_array[$field->name] == '')) {
$errorFlag = true;
$errorMessage = 'Profile Not completed';

Suganya M

I have a similar requirement

Stomper's picture

I have a similar requirement for my application.

I have divided the user profile registration into two sections, basic and full. The basic section only requires name and email, basic user information. Users who have completed this section have access to the forums and other community site features. My application also incorporates UC Marketplace, and in order for users to view seller profile information, complete transactions etc they need to complete the full section. The full section would require information pertaining to paypal accounts, credit card accounts etc.

Would it be possible to restrict access/capability based on whether the necessary profile registration sections are completed?

Been there, done that like so...

greta_drupal's picture

I would recommend installing Auto Role Assign module, which allows you to create unique registration pages for different roles. Then, you server content based on role type. As you might already know, you can restrict Blocks, Nodes*, and Views by role quite easily.

  • Add Content Access module for this.

Another advantage of using Auto Role Assign is that you get the opportunity to create a registration page that is not entitled /user/register, which attracts spam accounts (they all know this page). You then can offer your unique registration links somewhere deeper so that the drive-by spammers don't pounce on it. Then, you can probably set a Rule to disable/delete/??? user accounts that are created from the user/register URL. At least, I'm hoping so. That is next on my list of things to do.

I use the above described approach on one of my sites:
topnav: Awards
Apply for Awards Nomination

dhakshinait's picture

can you tell me how to remove "create an account" page and show "access denied " message if anonymous user access "user/register" page?

Hello, Instead of redirecting

bumathan's picture

Instead of redirecting the user to the profile creation page, is it possible to redirect him on the profile edit page if a specific cck field is still empty ?

For example, the user has to fill in basic informations when he creates his account. The profile has also some extended informations such as bio fields etc and I want to redirect him on the profile page if the bio field is still empty.

How can I do that ?

Thank you