Tweeted twitter.com/#!/StackDrupal/status/554933274020433921
3 added 4 characters in body
source | link

I have tried making this a rule as well as used hook_userhook_user with no luck. It definitely gets inside of the login case (had a watchdog log), but the redirect doesn't happen and they are still sent to /user/user upon logging in.

I am trying this with no luck:

/**
 * Implementation of hook_user()
 */

function multistep_registration_user($op, &$edit, &$account, $category = NULL) {
    switch ($op) {
        case 'insert':
            multistep_registration_save_content_profile_name($account);
            break;
        case 'login':
            if (!multistep_registration_is_complete($account->uid)) {
                drupal_goto('user/register/complete-registration');
                exit;
            }
            break;
        default:
            break;
    }
}


function multistep_registration_is_complete($uid) {     
    if ($uid == 1) {
        return TRUE;
    }

    $node = content_profile_load('profile', $uid);

    if ($node->field_completed_registration[0]['value'] == 'yes') {
        return TRUE;    
    }

    return FALSE;
}

Why is it not redirecting? New users all have the value set as 'no'.

I have tried making this a rule as well as used hook_user with no luck. It definitely gets inside of the login case (had a watchdog log), but the redirect doesn't happen and they are still sent to /user upon logging in.

I am trying this with no luck:

/**
 * Implementation of hook_user()
 */

function multistep_registration_user($op, &$edit, &$account, $category = NULL) {
    switch ($op) {
        case 'insert':
            multistep_registration_save_content_profile_name($account);
            break;
        case 'login':
            if (!multistep_registration_is_complete($account->uid)) {
                drupal_goto('user/register/complete-registration');
                exit;
            }
            break;
        default:
            break;
    }
}


function multistep_registration_is_complete($uid) {     
    if ($uid == 1) {
        return TRUE;
    }

    $node = content_profile_load('profile', $uid);

    if ($node->field_completed_registration[0]['value'] == 'yes') {
        return TRUE;    
    }

    return FALSE;
}

Why is it not redirecting? New users all have the value set as 'no'.

I have tried making this a rule as well as used hook_user with no luck. It definitely gets inside of the login case (had a watchdog log), but the redirect doesn't happen and they are still sent to /user upon logging in.

I am trying this with no luck:

/**
 * Implementation of hook_user()
 */

function multistep_registration_user($op, &$edit, &$account, $category = NULL) {
    switch ($op) {
        case 'insert':
            multistep_registration_save_content_profile_name($account);
            break;
        case 'login':
            if (!multistep_registration_is_complete($account->uid)) {
                drupal_goto('user/register/complete-registration');
                exit;
            }
            break;
        default:
            break;
    }
}


function multistep_registration_is_complete($uid) {     
    if ($uid == 1) {
        return TRUE;
    }

    $node = content_profile_load('profile', $uid);

    if ($node->field_completed_registration[0]['value'] == 'yes') {
        return TRUE;    
    }

    return FALSE;
}

Why is it not redirecting? New users all have the value set as 'no'.

2 edited tags
| link
1
source | link

Redirect on Login?

I have tried making this a rule as well as used hook_user with no luck. It definitely gets inside of the login case (had a watchdog log), but the redirect doesn't happen and they are still sent to /user upon logging in.

I am trying this with no luck:

/**
 * Implementation of hook_user()
 */

function multistep_registration_user($op, &$edit, &$account, $category = NULL) {
    switch ($op) {
        case 'insert':
            multistep_registration_save_content_profile_name($account);
            break;
        case 'login':
            if (!multistep_registration_is_complete($account->uid)) {
                drupal_goto('user/register/complete-registration');
                exit;
            }
            break;
        default:
            break;
    }
}


function multistep_registration_is_complete($uid) {     
    if ($uid == 1) {
        return TRUE;
    }

    $node = content_profile_load('profile', $uid);

    if ($node->field_completed_registration[0]['value'] == 'yes') {
        return TRUE;    
    }

    return FALSE;
}

Why is it not redirecting? New users all have the value set as 'no'.