I know that's development version, but maybe following issues can be useful:
Followed existing code during inserting the user checking only first part of the path (arg(0)):
function autoassignrole_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
$page = db_fetch_object(db_query("SELECT rid FROM {autoassignrole_page} WHERE path = '%s'", arg(0)));
...
$edit['roles'] = NULL;
break;
And at the end, even if some role has been assigned, it's deleted anyway (NULL).
I.E. when I have set path to 'user/register', it's checking only 'user' path, so query return empty array.
The right code should be like this:
$path = substr(request_uri(),1);
$page = db_fetch_object(db_query("SELECT rid FROM {autoassignrole_page} WHERE path = '%s'", $path));
...
//$edit['roles'] = NULL; // delete this line
Comments
Comment #1
cyberswat commentedCould you begin by stating what your problem is? You are not allowed to set paths to user/register* or user/password* and should have gotten a validation error when you try to enter either of those as a path.
Comment #2
cyberswat commentedComment #3
cyberswat commentedhttp://drupal.org/cvs?commit=146157 applies the path issue you identified ... let me know if there is something else that needs to be looked at
Comment #4
kenorb commentedThank you.
But there is no any validation for 'user/register' path. Anyway it's working, when you changing something (i.e. title or link), but I haven't tested if role assignment is working.
Comment #5
kenorb commentedThe main point is I can't module make it working using paths as I want.
The next problem is explained here: http://drupal.org/node/320597
Comment #6
kenorb commentedIssue fixed.
Comment #7
kenorb commentedThere should be small fix from:
to:
Because in the first example, when you have additional variables (like /some/page?custom=variable) or you are not using clean URLs, path is wrong received. The same method is used in block.module
The same in autoassignrole_form_alter().
Comment #8
wim leersYep, kenorb's change is necessary to get this to work. Path-based role assignment finally started working after I came to the same conclusion as kenorb.
Also: this module is a prime example of the necessity of unit tests. It's too hard to test everything by hand, and unit tests overcome that problem.
Comment #9
cyberswat commentedhttp://drupal.org/cvs?commit=150519 @Wim Leers Feel free to contribute #304143: SImpletests
Comment #10
wim leersGreat, thanks cyberswat :)
Unfortunately I'm prevented from doing any Drupal work the next few months. So I'll have to leave writing SimpleTests to others. Good luck with that though! :)