madhatter23 - fantastic module, btw, really comes in handy.

This is a continuation of http://drupal.org/node/1399634 , but now applies to 7.x-2.x-dev. I know this branch is not production ready, but it has been working so great until now, and I am fully committed, so I hope I can push through this.

Issue Recap
Problem occurs when I enable unique registration paths and I am auto assigning a role based on that path. I have 3 profiles, call them "Customer", "Vendor", "Employee". I am trying to auto assign a role by the same name based on their path.

example.com/vendor/register
example.com/employee/register
example.com/user/register - this should get the customer role.

However, anyone who registers with the path example.com/user/register never receives their role.

As I mentioned, this was addressed in the 7.x-1.0 branch with the referenced Issue. It was resolved with the patch in this comment http://drupal.org/node/1399634#comment-5455922, and was later committed to Dev for that branch.

I am trying to update the patch to work with 7.x-2.x-dev. As you know, the structure of the referenced functions in the patch has changed dramatically.

So, I am wondering if you can help me work through the patch for this branch? Or am I completely out of luck?

If I am out of luck, how do you recommend I down grade? Uninstall the module and set up all registration paths? Is there anything else I need to consider?

I really am hoping we can work through this to get 7.x.2.x-dev working. THANKS!

Comments

grasmash’s picture

This probably won't be that difficult to fix. The main issue with the 7.x-2.x branch at the moment centers on the ability to choose 'tabs' or 'separate environments' for display.

Not quite sure why this isn't working, but I imagine it stems from that new feature.

I wouldn't start by modifying scubafly's patch. I don't think I ever actually used it-- I made more systemic changes.

If you're going to downgrade, I think that you would probably be ok with just replacing the module folder-- there weren't any changes to db structure between 7.x-1.x and 7.x-2.x. Just be sure to clear your caches, and to be save, you may want to re-save the profile types.

Question-- when you register via example.com/user/register, do it correctly add any profile fields specific to that path?

scottsawyer’s picture

Thank you for the fast response.

When I set my Customer profile login URL to customer/register - my profile fields appear

When I set login URL to user/register - profile fields do not appear.

With customer/register - auto assign role works.

Also, I noticed the Register tabs on the log in / register / forgot password screens have a label "Register as Customer" when the path is set to customer/register. When path is set to user/register, the tab label is "Create a new Account".

However, the option to set the Tab Label is only shown when I set "Path Type" to "Tabs" on the Profile Edit screen. It would seem to me that setting the Tab is not mutually exclusive to setting "Separate environment". Maybe the ability to set the Tab label should be displayed on the Edit screen regardless of setting "Separate environment"?

Thanks for any help, I really would prefer not to down grade, but it does sound like it is an option.

tmsimont’s picture

I have the same issue in 1.8

I found the issue in this function in profile2_regpath.module, line 86:

/**
 * Implements hook_menu_alter().
 */
function profile2_regpath_menu_alter(&$items) {
  // Check to see if the default 'user' path is being used with Profile2.
  if ($user_paths = profile2_regpath_get_profiles('user')) {
    // Build form at user/register using _profile2_regpath_user_register().
    $items['user/register']['page callback'] = '_profile2_regpath_user_register';
    $items['user/register']['page arguments'] = array($user_paths);
    $items['user/register']['file'] = 'registration_form.inc';
    $items['user/register']['file path'] = drupal_get_path('module', 'profile2_regpath');

    return $items;
  }
}

The problem is the way 'page arguments' are set, it should be:

/**
 * Implements hook_menu_alter().
 */
function profile2_regpath_menu_alter(&$items) {
  // Check to see if the default 'user' path is being used with Profile2.
  if ($user_paths = profile2_regpath_get_profiles('user')) {
    // Build form at user/register using _profile2_regpath_user_register().
    $items['user/register']['page callback'] = '_profile2_regpath_user_register';
    $items['user/register']['page arguments'] = array('profiles'=>$user_paths);
    $items['user/register']['file'] = 'registration_form.inc';
    $items['user/register']['file path'] = drupal_get_path('module', 'profile2_regpath');

    return $items;
  }
}

notice that in the latter the array is keyed with "profiles"

grasmash’s picture

Thanks for catching that! I've pushed this fix to both branches.

grasmash’s picture

Status: Active » Fixed

closing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.