Hi,

I'm getting following error "The account type is not valid. You must choose from the dropdown list." when I'm trying to assign account type to the membership.

I went throw the readme file step-by-step twice :( and same result.

I have 2 pageroutes, one for "simple users" and other for the "advanced users".
Also I have two account types "simple account" and "advanced account" for the simple account I made simple role checked and for the advanced account advanced role is checked.

What could be wrong?

Comments

rconstantine’s picture

Okay, I'm looking up the error message now...

So, you select the account type from the drop down on this page: admin/user/nf_registration_mod, and this is the error you get at validation, right?

Are you using the DEV version of the accounttypes module? You must if you aren't. Get it here

As for the code, the two functions involved couldn't be simpler, so I'm pretty sure we need to look perhaps at other things. What are your system specs?

mixey’s picture

I'm running drupal 5.1.x on localhost.
I wasn't using dev version, I'll give it a spin shourtly. hope that helps :)

rconstantine’s picture

Did you try dev yet? I mean of the accounttypes module.

mixey’s picture

I'm sorry, but I didn't tried it yet. It was for my personal project, but right now overloaded at the job, so I just don't have any time to give it a spin.

Thank you for asking.
Some day I'll post my results.

ezrac’s picture

Hi,

I am also getting the same error. I am using accounttypes-5.x-1.x-dev.tar.gz.

created an account type: consultant
assigned both roles (allow + init)
created role: consultant

When going to Tie account type to membership -> select consultant from drop down and get the same error.

Regards,

Ezra

Patrick Nelson’s picture

I get the same error too. Currently using:

Account Types 5.x-1.x-dev
Registration Modifier 5.x-1.0

I'll check that these are the latest versions and, if not, will upgrade and try again and report back here.

Regards

Patrick

Patrick Nelson’s picture

OK, updated the accounttypes module but am still receiving the same error message. Not sure why yet, but will continue to investigate

zahor’s picture

Have you guys also assigned the permissions? Also, note that user/1 cannot get a role if it hasn't been assigned to his account type. In my case, I initially didn't give myself an account type because I figured as "user/1" I have all access, but that's not the case.

I have the same modules you all have and it works fine.

rconstantine’s picture

That's good to know. That probably isn't ideal operation, so I'll look into that. But for now, make sure you assign user 1 an account type and see if that does it. I'll be setting all of this up on a fresh site today or tomorrow and so I'll be able to see if there was a setup step that I overlooked to tell you guys. It may be that I've been to close to the projects to see something obvious.

ezrac’s picture

Hi,

Does anyone know if there is a solution for this yet?

rconstantine’s picture

I set this up on a new host and didn't have a problem.

Q: can you setup and use accounttypes without this module successfully? Absolutely make sure you can. If not, post a comment here, then open an issue over there.

Q: please give all system stats; MySQL version, PHP version, OS & version, Apache (or other) version, Drupal version, module(s) version(s), web host & plan, and anything else you can think of. Oh, a list of enabled modules might help. Perhaps there's a conflict.

Until all of you guys give me more data, there isn't anything I can do to help.

ezrac’s picture

I created this on 2 different instances - Win XP Pro & Win Server 2003, IIS5 & IIS6, modules installed:

Subform Element 5.x-1.x-dev
Account Types 5.x-1.2
Registration Modifier 5.x-1.x-dev
Node Family 5.x-1.x-dev
Node Profile 5.x-1.x-dev
Pageroute 5.x-1.x-dev
Pageroute Nodefamilies 5.x-1.x-dev
Pageroute UI 5.x-1.x-dev

Also, tried all the above modules with the lastest realeases in the past few days. Same result.

MySQL 5.0.25
PHP 5.2.3

I have been able to setup with account types, but all this does is take away the 4th tab in reg types

rconstantine’s picture

I have been able to setup with account types, but all this does is take away the 4th tab in reg types

I'm not sure you answered the question of whether accounttypes is working without reg mod. Accounttypes is a stand-alone module that allows for the restriction of roles. Is this much working? You have setup account types and assigned roles to each? You have then assigned account types to your users? I assume you've read the accounttypes README?

I see in #5, you said

assigned both roles (allow + init)

, so I gather that you went through all roles and assigned 'allow' and 'init' as needed.

So, since I can't duplicate this myself, I need you to hack the .module file. Find the function called "nf_registration_mod_tie_account_type_validate" and just after "$account_types = get_accounttypes();" place this line of code:
drupal_set_message('<pre>Account types: ' .print_r($account_types, TRUE). '</pre>');

and maybe also add this line just after that one:
drupal_set_message('<pre>Form values: ' .print_r($form_values, TRUE). '</pre>');

Then cut/paste the results here.

ezrac’s picture

Thanks for the feedback. Here is the output:

Account types: Array
(
[1] => basic
[2] => consultant
[3] => employer
)
Form values: Array
(
[SAP Consultant] =>
[SAP Employer] =>
[op] => Save assignments
[submit] => Save assignments
[form_token] => 33a646ec44f04e873572f70ef3f8abbd
[form_id] => nf_registration_mod_tie_account_type
)
The account type is not valid. You must choose from the dropdown list.
The account type is not valid. You must choose from the dropdown list.
Membership title Account types
SAP Consultant basicconsultantemployer
SAP Employer basicconsultantemployer

ezrac’s picture

Sorry in answer to your questions:

I'm not sure you answered the question of whether accounttypes is working without reg mod. Accounttypes is a stand-alone module that allows for the restriction of roles. Is this much working?

When I disable reg mod - I create a new user account and the result is as follows:

Creates the account with message "warning: Invalid argument supplied for foreach() in C:\Inetpub\wwwroot\SAP\modules\accounttypes\accounttypes.module on line 1226."

When I go to the user management:

sap active basic authenticated user

When I edit the user to simulate the verification:

Click account type (consultant) -> auto selects the role consultant.

sap active consultant consultant

So, it appears its working except the warning above.

You have setup account types and assigned roles to each?

Yes

You have then assigned account types to your users?

Yes

I assume you've read the accounttypes README?

Yes

rconstantine’s picture

Now we are getting somewhere - maybe.

First, looking at your form values, the account types aren't being assigned to the membership types. There would be a number (1, 2, 3) with either SAP consultant or SAP Employer. So that is why you get the error from Reg mod.

However, you should not be getting errors from accounttypes on its own. This may be the underlying problem. I am confused about the error you mention on line 1226 of accounttypes as that does not correspond to a foreach loop. So let's put this issue on hold and why don't you open one over at accounttypes? I'll see you over there.

BTW, I'm uploading a new dev version of accounttypes. Try it out when the tarball becomes available. Who knows, maybe I fixed it on accident.

rconstantine’s picture

Version: 5.x-1.0 » 5.x-1.x-dev
Assigned: Unassigned » rconstantine

I just noticed that this issue is opened against 1.0, but both dev and 1.2 were having the same issue. So I'm bumping the version to dev.

ezrac’s picture

If this is helps?

I disabled account types and kept reg mod:

"warning: Invalid argument supplied for foreach() in C:\Inetpub\wwwroot\SAP\modules\nf_registration_mod\nf_registration_mod.module on line 936."

Edit the new user and assigned the role:

test active consultant

rconstantine’s picture

That error would indicate that you haven't set up any pageroutes with your nodeprofiles.

ezrac’s picture

I have setup the pageroutes?

Pageroute List routes Add route

Path Operations

Consultants Edit route Edit pages Add page

Employers Edit route Edit pages Add page

rconstantine’s picture

I'm not sure what your message is supposed to mean. Did you add pages to the routes?

ezrac’s picture

What I am saying is that there are pageroutes setup. Your prior response says that the warning is due to not hvaing the pageroute setup.

ezrac’s picture

Is there a problem with the modules or is it just the case that I (and it appears others) don't have a clue how to use your modules? Please let us know. If it is the former, any suggestions? If it is the later, where can one get help?

rconstantine’s picture

This is admittedly a complicated module to use, made even more so due to the modules it depends on. Several features of those modules make this module UNUSABLE. Consequently, I am now thinking that perhaps I should form_alter nodeprofiles and pageroutes and eliminate all options that this module does not use. I have set this module up for my own use at least six times with no difficulty. Likewise, I know of several people that have posted to this queue that I've helped successfully install and use this module.

Like I've posted elsewhere, I clearly state in the README which version of each file (not release) I have used in creating and testing this module. If the author of pageroute has changed things since then to such a degree that my module doesn't work with it, then it is the responsibility of the user to figure out how to go back and get older versions of pageroute that will work with this module. I will update this module eventually to work with newer versions of dependent modules as time allows. But time will not allow it for several months due to the number of modules I have in various stages of development and which need to be completed. I have a business to run and releasing these modules to the public is a kindness born out of the belief that open source software should be supported. It is neither required of me to release my modules, nor for users to use them. Both my README and my issue queue help that I provide are far above average when compared to the majority of module developers out there. You used the plural of the word module - modules - when saying that people don't understand how to use my modules. Which other modules are you or others having trouble with? Most of the rest of them are fairly simple. This one is the biggie.

So although I can understand that some time has passed since you started trying to get this module to work for your installation, and that you are frustrated, if I can't duplicate a problem, or if the user can't describe it accurately enough, then I can't possibly fix anything about it. I now include in the README a link to an issue where I helped a user set this up. In that thread, he posted many screen shots of his setup. Doing so was helpful in getting him straightened out. I have repeatedly told people to read the documentation and that thread is now a part of it. If you have not read it and compared those screen shots to your own setup, then you have been wasting both of our time. I even adjusted the README based on the outcome of that thread in an attempt to be more clear in the settings needed. It would help if you would write down a step-by-step listing of ALL procedures you go through in trying to setup this and all related modules. Write it as a text document and attach it to your next post. If you feel my README isn't detailed enough, then I would expect your step-by-step listing to be even more detailed.

I'd like this module to work for you. I'm not sure what else you expect that I should be able to do. I'm not a magician or a mind reader.

ezrac’s picture

We all understand appreciate your contribution and the intention was not meant as an attack on you.

Were can one see the step-by-step screen shots that the user posted? Prehaps, there is something in this that will identify where a possible common mistake is made?

Thanks for you inputs!!!

rconstantine’s picture

I thought that I included the URL to the post in the latest README. Is it not there?

rconstantine’s picture

BTW, I didn't think you were attacking me. So don't worry about that. You have been quite nice through all of this. Take a look at some of the other posts in this queue and you'll find others not so nice.

Coleslaw’s picture

I was having the same problem, tying account type to membership was spitting out the aforementioned error. ezrac posted this output.

Account types: Array
(
[1] => basic
[2] => consultant
[3] => employer
)
Form values: Array
(
[SAP Consultant] =>
[SAP Employer] =>
[op] => Save assignments
[submit] => Save assignments
[form_token] => 33a646ec44f04e873572f70ef3f8abbd
[form_id] => nf_registration_mod_tie_account_type
)
The account type is not valid. You must choose from the dropdown list.
The account type is not valid. You must choose from the dropdown list.
Membership title Account types
SAP Consultant basicconsultantemployer
SAP Employer basicconsultantemployer

The problem is actually quite simple. You have assigned the membership title as the name value in the form. So if someone, like ezrac and I did, enter a membership title with a space in it (or other chars which cannot be used in a variable name) the form value isn't sent through.

Hope this helps some people.

Now with that problem fixed, it gets me a little farther and into new problems. I'm off to figure out these new error messages upon login. :)

rconstantine’s picture

Title: assigning account type to the membership » [SOLVED]assigning account type to the membership -> don't use characters in your membership names that wouldn't be valid for...
Status: Active » Fixed

As mentioned above, it seems you need to make sure your membership titles are constructed like valid php variables; i.e. no spaces (are there any more restrictions applicable here?)

So maybe use camel-case if you need multiple words, or dashes or underscores. I know dashes work.

Coleslaw’s picture

The problem still remains that the membership titles are what appear in the dropdown menu in the signup process. Using variable safe names aren't really what you want to be showing in your menus.

What I mentioned isn't a "fix", its just a way to get around the errors until the code can be corrected.

If you were having this problem and changed the membership titles to variable safe names, all the members that signed up before you made the change will either need to be deleted or have their membership manually changed in the database to the new name. From what I can see, changing the membership title's name orphans all the members in that membership group. This causes a bunch of errors upon login since they're associated with the old name which doesn't exist anymore.

rconstantine’s picture

So would it be more accurate to say that for now you should use a single word for the title? Have you had a chance to figure out where the problem in the code is - even if you don't have a solution?

Also, are you saying that changing the title via admin/user/nf_registration_mod/edit/[name of membership here] doesn't work? If so, please file this as a new issue. I thought I tested this and had it working.

Anonymous’s picture

Status: Fixed » Closed (fixed)