Fill out membership application

7 replies [Last post]
rustamchicago
Offline
Joined: 07/28/2010
Status: 
Answered

Hello everybody,
I have installed "Membership Suite" module. It does fantastic job. The only thing I would like to ask you is the integration of Content Profile module with Membership Suite.
Now when visitors pay the membership fee, Membership Suite module will assign them new role. I made new content profile (with Content Profile module) - "Membership Application". So, as soon as visitors buy membership and assign new role, the "Membership Application" will be available for them (there will be 'Create Content ~~> Membership Application' link on the navigation menu).
So, my question is, how to enforce new members to fill out this 'Membership Application' content profile? Because members may skip that step all the time.
Thank you for your help and support. Any advice would be appreciated!

Rustam.

Leighton Whiting
Offline
Joined: 06/02/2009
There is no way to 'force' a

There is no way to 'force' a user to fill it out, but you can remind them on every page they visit until they fill it out, which I've found is very effective. Assuming that the 'type' name of your Membership Application content type is 'membership_application', you can place the following code in your template.php file in your theme folder and it will do the trick:

// Show a message if the user hasn't created their profile yet
if (module_exists('content_profile')) {
  global $user;
  // Change this type to whatever the type of your content profile is
  $type = 'membership_application';
  // Make sure the user can create the content profile first, then check if the user already has one or not
  if (arg(2) != 'edit' AND user_access('create '. $type .' content') AND !content_profile_load($type, $user->uid)) {
    // The user doesn't have one, so show a message to the user to create one
    drupal_set_message(t('You still need to fill out your profile! !link', array('!link' => l('Click Here', 'user/'. $user->uid .'/edit/'. $type))));
  }
}

If you want to really force them to fill it out, you can do the following instead of the drupal_set_message line, which will redirect them every time they visit your site to the fill out page if they haven't done so yet:

drupal_goto('user/'. $user->uid .'/edit/'. $type);

Sincerely,

Leighton Whiting

rustamchicago
Offline
Joined: 07/28/2010
drupal_goto() does not work

Hi, Thank you for your help and support.
I tried to use code above, but I am always getting error:
"The requested page could not be found." Both functions does not working (drupal_set_message() and drupal_goto()).
The name of your Membership Application content type is 'membership_application'. Any advice would appreciated!

Rustam.

Leighton Whiting
Offline
Joined: 06/02/2009
Rustam, What page is giving

Rustam,
What page is giving the 'This page could not be found' error? If you are using drupal_set_message, this error shouldn't be applicable, but if you are using the drupal_goto, then I can see how this may be applicable. The message won't show unless the user a) has permission to create the content type, b) is logged in, and c) content profile is installed. Basically if the user can create the content profile, they should see the message.

Sincerely,
Leighton Whiting

Leighton Whiting
Offline
Joined: 06/02/2009
It looks like instead of

It looks like instead of 'edit', you would need to use 'profile' (I guess on your site it's different than mine). So use this for the link in the drupal_goto:

'user/'. $user->uid .'/profile/'. $type

Sincerely,
Leighton Whiting

rustamchicago
Offline
Joined: 07/28/2010
I tried to replace the code

Hi and thank you for your reply.
I tried to replace the code to 'user/'. $user->uid .'/profile/'. $type.
and I am using drupal_goto() function. But now I am getting another error:

This webpage has a redirect loop.
The webpage at http://www.uzbekchicago.org/user/609/profile/membership_application has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

Thank you you in advance
Rustam.

Leighton Whiting
Offline
Joined: 06/02/2009
Rustam, Did you replace both

Rustam,

Did you replace both 'edit' s with 'profile'? If not, it will loop.

if (arg(2) != 'edit' AND user_access('create '. $type .' content') AND !content_profile_load($type, $user->uid)) {

should be

if (arg(2) != 'profile' AND user_access('create '. $type .' content') AND !content_profile_load($type, $user->uid)) {

Sincerely,
Leighton Whiting

rustamchicago
Offline
Joined: 07/28/2010
Thank you

Hi,
Thank you so much, now it works PERFECTLY!!!
I am so happy, my regards and all the best!

Rustam.

Twitter Feed