Hi there,

I'm using pageroute + profile_setup + logintoboggan to setup a multi-step user registration process. I let logintoboggan immediately log the user in after inputting the username/email/password, and redirect user to the proper pageroute. But the problem is, the sub-pages in the pagerouate never have properly adorned URL, and the registration process cannot be completed.

For example, I'm having pages profile-1 profile-2 profile-3 setup under the route www.example.com/register-route, each corresponding to a content profile type. Normally when redirected to www.example.com/register-route upon registration, it actually takes you to www.example.com/register-route/profile-1; then you fill out the form and click forward, it should take you to www.example.com/register-route/profile-2, so on and so forth.

In my case, the last part aka page-# are not attached to the URL. After redirection, I'm at www.example.com/register-route where I get to fill out form page-1; forward once, it takes me to some weired place such as www.example.com/node/43/edit?destination=user/52 (after checking, node/43 is actually the content profile node for profile-1).

But when you manually put in www.example.com/register-route/profile-2, or profile-3, the pages are still there; it just cannot be reached in the page route flow.

What could cause the problem?

PS: I changed the logintoboggan module a little bit, added a logintoboggan_rules_event_info(), and fires a rules_invoke_event() in the function logintoboggan_user_register_submit(). Is it possible that this is conflicting with the pageroute?

Comments

cyrusvhadsupper’s picture

btw, the forward button for www.example.com/register-route has the html code:

<input id="edit-forward" class="form-submit pageroute-forward" type="submit" value="Next" name=“page_op">

When I click, it takes me to www.example.com/node/43/edit?destination=user/52 instead of the next page in the page route flow.

cyrusvhadsupper’s picture

OK, seems not attaching the tail part of the URL should not be a problem; the page route should still be able to be stepped through.

I tried with "node view" type of pages of page route, and it works just fine;

I tried with node-view-1 + profile-page-1 + node-view-2 + profile-page-2, and it works just fine as well;

Only when you connect two content profile forms together will then get this error... I guess something is wrong with profile_setup module. I will dig more

cyrusvhadsupper’s picture

I got rid of most of the modules involved, page_route, profile_setup, logintoboggan, rules; and then reinstalled just pageroute and profile_setup to see what will happen.

now without logintoboggan I cannot immediate login just-registered user and go through the step-by-step profile setup; instead, I just create the account, login manually, and go to the profile setup page route manually.

problem REMAINS! this time it is a little different.

the forward button in the first profile setup page leads to a successful creation of the first content profile node; then in the second profile setup page it has nothing but just a title field (which clearly has the title information of the 1st profile page), and forward/back buttons. click forward button, you will see the error msg:

This content has been modified by another user, changes cannot be saved.

pirofun’s picture

i am experiencing the same issue.

I have uninstalled profile_setup and instead am using the dev version of content profile which provides pageroute info. i am then building my subpages using the Content profile editing form (content_profile) type provided by the dev version of content profile.

I get the same as #3. If i type in the subpage URL manually i see the appropriate edit form. If you move forward in the pageroute it appears as though the form is being submitted and you are being returned to the same edit form however all custom CCK fields are removed and only TITLE/BODY appear.

A related post suggested a possible relationship with a flaw in memcache however i uninstalled memcache and removed the config from settings.php and the problem persisted.

pirofun’s picture

Upon further experimentation i can flesh #4 out a bit. The pageroute flow functions correctly when i keep the default forward button text as "Forward". When i change this value the pageroute breaks.

This seems to happen regardless of the pageroute page type (although i have only tested it with NODE EDIT, to which the pageroute also breaks). So evidence suggests an issue with the pageroute module specifically the functionality regarding the FORWARD button text. I haven't looked into the code for pageroute yet but i am going to start exploring this to see if i can find the area of CODE RAGE.

It seems odd to me that no one else has reported this issue (or maybe i missed it) so that suggests to me that this could also be a compatibility issue with another module although again, i have yet to look at the code.

saturnino’s picture

Assigned: Unassigned » saturnino

in the file pageroute.module at line 308, I made some changes you can see below

/**
 * Submit function for all pageroute forms, except submit-like tab buttons
 * Redirect to the set target.
 */
function pageroute_page_form_submit($form, &$form_state) {

  $page = &$form_state['page'];
  $route = &$form_state['storage']['route'];
  
 /* hack saturnino part */
  if(!empty( $page->options['neighbours']['forward']) )
  {
		drupal_redirect_form($form, $route->path.'/'.$page->options['neighbours']['forward']);
		return;
  }
  /* hack saturnino part */
  
  // no page access -> try redirect
  if (!$route->checkPageAccess($page->name, $form_state['target'])) {
    unset($form_state['storage']);
    $form_state['rebuild'] = FALSE;

    if ($route->options['redirect_path']) {
      drupal_redirect_form($form, pageroute_get_redirect_path($page));
      return;
    }

    drupal_not_found();
    pageroute_exit_now();
    return;
  }

  $form_state['rebuild'] = TRUE;
}

Now page url are properly generated.

But now, I would like to override the pageroute_page_form_submit function with a custom module, but i can't figure how to do that...
Somebody can help me please?

thank you.

sponsch’s picture

I had the same issue. The code of #6 fixed it (thanks a lot), but not for the first step of the pageroute.

charles.holtzkampf’s picture

Hi,

I have the exact same issue. So I installed a clean drupal, and only added the page route module, CCK and content profile. But the problem remains. I will try the code above tonight and report back.

if the code works, you are the man !

Charles

charles.holtzkampf’s picture

it works you are the man

Anonymous’s picture

The problem happens using beta 5 when changing the name of the Forward button. The module completely breaks.

I guess it has something to do with this in pageroute.page_edit.inc:

  public function formSubmitted(&$form_state) {
    $todo = NULL;
    $args = &$form_state['storage']['route']->args;

    switch ($form_state['clicked_button']['#value']) {
      case t('Delete'):
        if (is_numeric($form_state['clicked_button']['#name'])) {
          $target = $form_state['clicked_button']['#name'];
        }
        else {
          $target = $args['todo']['target'];
        }
        $args['hide_pageroute_buttons'] = TRUE;
        $todo = array('action' => $form_state['clicked_button']['#value'], 'target' => $target);
        break;
      case t('Save'):
        $args['default_target'] = PAGEROUTE_CURRENT;
      case t('Forward'):
      case t('Back'):
        unset($form_state['node']);
        break;
    }

    $args['todo'] = $todo;
  }

It is examining the actual button text in a case switch. Doesn't seem very ideal given you can change it in options.

The hack in #6 is nice for the issue of changing URLs. However, apparently Drupal must use $form_state['rebuild'] = TRUE; in multi-step forms otherwise the "back" button isn't going to work. Using the hack above back buttons are broken because the rebuild line doesn't get hit.