An administrator is able specify multiple registration paths, and configure each one for specific auto role assignment settings.

Example:

/user/register/trial ('trial' role assigned)
/user/register/poweruser ('member' and 'power user' roles assigned)
/somepath/signup ('member' role assigned)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cyberswat’s picture

I think that for the d7 version it makes a lot of sense to turn the paths that aar looks at into tokens. I'm trying to envision what this functionality should look like. I think the integration with Content Profile has been good for the d6 version but that approach can be greatly improved in the d7 version.

mrfelton’s picture

I'm not sure I know what you mean by turning paths that aar looks at into tokens...?

cyberswat’s picture

Take a look at http://drupal.org/project/token and http://drupal.org/project/pathauto ... Here's an issue that begins to outline a use case #927076: autoassignrole by path tokens ... it's a little incorrect to say turn the paths into tokens. A clearer way of saying that is to allow AAR to use tokens to define paths that would be assigned role(s).

mrfelton’s picture

Right, but I don't see that as an essential part of this feature request. Maybe a nice addition, but should probably belong in another ticket.

For this request, we simply need to be able to create any number of paths, each of which will have a user registration form, and automatically assigned roles based on the config of the path in the admin interface.

cyberswat’s picture

Ok ... I understand your point now. Thanks for entering this use case ... I'm looking to get it in place relatively quickly and have added it to the release plan on the project page.

vantuykom’s picture

I don't see any possibility to set the paths. Do I need an extra module for this function?

TripX’s picture

Subscribe

Sadly there is no possibility to set paths.

ebeyrent’s picture

+1

felipepodesta’s picture

+1
Subs

vasna sdoeung’s picture

sub

theullrich’s picture

sub

andrenoronha’s picture

subscribe!

jayco33’s picture

subscribe

Anonymous’s picture

subscribe

modstore’s picture

subscribe

juroon’s picture

subscribe

Noe_’s picture

subscribe

canucked’s picture

What is the current status of this feature? How can one get involved in the development/testing?

marshallexcavating’s picture

I am also interested in the current status of this feature; and would like to know how to get involved in development and testing.

rubenlor’s picture

+1
Subs

tigerfinch’s picture

I need this feature for a project in the near future and so have started today on a simple implementation of this. I will release a patch in the next few days, hopefully someone else will find this useful.

tigerfinch’s picture

Ok, as promised here is a patch to provide this functionality.

For some reason ( I am not an experienced patcher! ) to get this patch to apply properly, I had to use the command:

patch -Np1 -d autoassignrole/ autoassignrole-paths-#971320-#21.patch

while in the directory containing the autoassignrole folder.

Remember to fully uninstall the module before using the patched version (it needs to run it's install file to add a table to the database...)

When the module is reactivated, you should find an extra menu option under admin/config/people/autoassignrole/ - called Per Role Pages. When you click on this you have the option to add a new role-specific page. You can choose which roles (more than one) are applied for this page, the title and the path. Make sure the path is not already in use (there is validation but I have found it slightly shaky..)

NB: concerning the path, you only need the root, as the subpages will be added. Eg. if you set the path to 'investor' - you will have a 'investor/login' etc. page generated.

There are two more options available. The display determines what type of page you want. If you choose standard, it will generate a page with tabs like the standard user login/register etc. page. The links will also be added to the menu you choose in the dropdown. If you choose individual, then they are not added to a menu and you will have to provide links to the pages ('string/register' etc.) - these pages have no tabs to link to the other pages.

Let me know how it goes, I hope the patching works ok!

g.paluch’s picture

+1 subscribe

natlandry’s picture

I am getting page not found error when I try to download this patch.

tigerfinch’s picture

Weird, don't know how I managed that. Here it is again:

tigerfinch’s picture

Another attempt

[Edit: Apologies for turning into sir spam-a-lot. I realised (duh) that the hashes were causing problems. THIS one you should be able to get hold of ok....]

iRex’s picture

subs

ardnet’s picture

subscribe

EvaldsUrtans’s picture

subscribe

ardnet’s picture

Hi tigerfinch,
I tested your patch there, but seems there's no code in autoassignrole.install, no?

Thanks

hefox’s picture

Status: Active » Needs review

There's a patch, so this is needs review, yes/no?

Status: Needs review » Needs work

The last submitted patch, autoassignrole-paths-971320-21.patch, failed testing.

mrfelton’s picture

As per #30 it looks like the .install code is missing from the patch.

tbeauchemin’s picture

subscribe

basicmagic.net’s picture

subscribe

cenforprofesional’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, autoassignrole-paths-971320-21.patch, failed testing.

middleman90’s picture

Status: Needs work » Needs review
RKS’s picture

Is anyone able to work on the patch and fix what's missing? Or anyone have a working solution?

RKS’s picture

For all

madmatter has supplied a patch in another issue here http://drupal.org/node/1334412#comment-5237696

The Prfile Registration Path module is a requirement of this functionality with his patch applied to Auto Assign Role, but the functionality is there for anyone who wants to test and see if this works for their use case.

stopshinal’s picture

RKS - i'm confused, i've applied madmatter's patch, but in and of its self it does nothing, correct? we need this patch to add the UI for selecting which path gets which role, correct?

I'm just a bit turned around by posts here and over at http://drupal.org/node/1334412

grasmash’s picture

stopshinal,

True, the patch that I submitted does nothing in and of itself. It simply adds a new hook to AAR that will permit other modules to add their own roles to during user registration.

Combining this patch with Profile2 Registration Path (7.x-1.x-dev) will allow you to set unique registration paths per profile2 profile type and assign specific roles to users who register via that path, which may or may not accomplish what you'd like.

grasmash’s picture

**UPDATE**
After receiving no response from AAR maintainers, I have removed AAR integration from Profile2 Registration Path.

Automatic assignment of roles during registration has been made native to the Profile2 Registration Path module. I'm sorry to have hijacked this thread. Good luck with the previously posted patch!

tigerfinch’s picture

Hi all - sorry for dropping off the map for so long -

As several of you noticed, the .install file was missing from my patch. I am a little n00bish when it comes to patching I must admit. Working on a patch now, using the documented git method, so hopefully will be more successful.

tigerfinch’s picture

Reworked patch uploaded!

msakurada’s picture

ok maybe this is an over simplification, but I only needed to get the /user/register/trial ('trial' role assigned) functionality working.

So I cut up the module to a custom module, threw in a SESSION variable and all I need is this instead of the whole module:

<?php
function mymodule_form_user_register_form_alter(&$form, &$form_state) {
   preg_match("/[^\/]+$/", $form['#action'], $matches);
  $action = $matches[0];
  $_SESSION['mymodule_role'] =  array();
  $role_key = array_search($action, user_roles(TRUE));
  if ($role_key > 3) {
    $_SESSION['mymodule_role'][$role_key] = (string) $role_key;
  }
}
  
function mymodule_user_presave(&$edit, $account, $category) {
    if (isset($account->is_new) && !empty($account->is_new)) {
      $roles_to_add = array();
      $roles_to_add += array_intersect_key($user_roles, array_filter($_SESSION['mymodule_role']));
      $edit['roles'] = $roles_to_add + $edit['roles'];
  }
}

I ensure the $role_key is greater then 3 to prevent administrator/built in roles from path assignment.
Anybody see problems? The SESSION variable lives on the server side so I don't think you can manipulate. This doesnt really contribute (it cuts out functionality) but its simple and clean. Thoughts?

TommyK’s picture

Status: Needs review » Needs work

tested patch in #45

Here is what I did:

  1. disabled/uninstalled previous version
  2. patched/installed latest dev release
  3. disabled Automatic and User Choice settings
  4. added new Per Role Page (x2)
  5. registered new users successfully with different roles
  6. tried to edit one of the new Per Role Pages
  7. edit seemed to work, but received error "Oh dear. Looks like the evil space monkeys messed something up again"
  8. breadcrumbs were all gone after saving edit

I'm so glad this patch is working well enough for me. I only mark it "needs work" because of the problems rebuilding the menu upon edit.

Thanks!

dgastudio’s picture

why do not use profile2_registrationpath???

joeforika’s picture

How do you apply this patch?? I tried to run the command in ssh inside the modules folder:
patch -Np1 -d / configurableregpaths-971320-44.patch
but it doesn't do anything and it doesnt give any error message either. pls help

DamienMcKenna’s picture

This should have a hook_update_N() script to migrate existing data from a D6 site (#1672630: Build D6->D7 upgrade path).

RaulMuroc’s picture

We need new co-mantainers of this module cuz since 2011 nobody works on this module and it is really useful.

Drupal prince’s picture

Status: Needs work » Needs review
rogical’s picture

Status: Needs review » Reviewed & tested by the community

like #47, we need to disable/uninstall this module first, and applied the patch, then it works.

There're some small issues but the function is working, we can commit this first.

rogical’s picture

Status: Reviewed & tested by the community » Needs work

The 'allow user to choose' feature is missing, we still need to have both solutions:

Allow user to Choose, Assign from path

pinkonomy’s picture

After applying the patch I take an error message and the path doesn't appear .

patching file autoassignrole.admin.inc
Hunk #1 succeeded at 167 (offset -7 lines).
patching file autoassignrole.install
Hunk #1 FAILED at 5.
1 out of 1 hunk FAILED -- saving rejects to file autoassignrole.install.rej
patching file autoassignrole.module
Hunk #1 FAILED at 59.
Hunk #2 succeeded at 93 (offset 2 lines).
Hunk #3 succeeded at 157 (offset 2 lines).
1 out of 3 hunks FAILED -- saving rejects to file autoassignrole.module.rej
patching file autoassignrole.paths.inc

Berliner-dupe’s picture

Is a new info available for Register Role by Path for Auto Assign Role?

I dont use Profile2 and i cant use Profile2 Registration Path for this.

acdtrp’s picture

Yeah, me too. The third option is not available without Profile2, is it?

RaulMuroc’s picture

I'm lost in this issue... which is latest patch? Could someone who knows re-attach it?

Anonymous’s picture

Issue summary: View changes
FileSize
19.43 KB

Here is the complete working module including the patch from #45 Thx to Tigerfinch. I had to remove the user_access ( 'administer users' ) in the autoassignrole_user_presave(&$edit, $account, $category) to get it working.

mike.davis’s picture

Status: Needs work » Needs review
FileSize
19.48 KB

Here is a re-rolled patch from #45 which applies fine now against the 7.x-1.x branch.

I have updated the .install file to use hook_update_N to create the new table so you don't need to uninstall, just apply the patch and run "drush updb"

I have also updated some of the comments to fit with coding standards.

Please review this as it would be good to get this in as a starting place for this functionality so that we can move to a stable release of 7.x-1.x.

There is a couple of things that I have noticed with this - there is no validation for existing paths of pages and there is no confirmation on deleting a page. These could be raised as new issues once it has been committed - unless the consensus is that these should be part of this patch (I think that the delete confirmation should be so might look at that)?

mike.davis’s picture

Here is an updated patch from #60, which adds a delete confirmation page to the auto assign pages - it was more straight forward that I thought it might be.

I have also cleaned up some code to adhere to coding standards and refactored the retrieving of the auto assign role pages.

I have also updated the menu to use the menu tabs on the pages so that you can easily change what you want to edit within the auto assign role module, rather than having to go to the menu each time.

mike.davis’s picture

OK, so I have update patch #61 further to set the schema on the .install file as well so that this sets the correct database table for new installs. I have also removed the menu tabs as this should really be part of a separate issue so I will create a new issue for this.

The last submitted patch, 60: autoassignrole-971320-60.patch, failed testing.

The last submitted patch, 61: autoassignrole-971320-61.patch, failed testing.

  • mike.davis committed e12dc41 on 7.x-1.x
    Issue #971320 by tigerfinch, mike.davis: Added Administrator configures...
mike.davis’s picture

Status: Needs review » Fixed

Patch #62 has been committed. We could really do with some tests for this new functionality, so I will raise a new issue to look at these.

  • mike.davis committed ea24c04 on 7.x-1.x
    Added missing for file #971320: Added Administrator configures...

Status: Fixed » Closed (fixed)

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